Skip to content

Commit

Permalink
Reduce the amount of included header files. Vast change like in "Oh G…
Browse files Browse the repository at this point in the history
…od! This revision changes half of the source files!".

Review URL: http://codereview.chromium.org/20378

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9958 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
maruel@chromium.org committed Feb 18, 2009
1 parent 22f2112 commit 319d9e6
Show file tree
Hide file tree
Showing 130 changed files with 1,544 additions and 1,261 deletions.
1 change: 0 additions & 1 deletion base/atomic_ref_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define BASE_ATOMIC_REF_COUNT_H_

#include "base/atomicops.h"
#include "base/basictypes.h"

namespace base {

Expand Down
1 change: 0 additions & 1 deletion base/ref_counted.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define BASE_REF_COUNTED_H_

#include "base/atomic_ref_count.h"
#include "base/basictypes.h"
#include "base/thread_collision_warner.h"

namespace base {
Expand Down
9 changes: 3 additions & 6 deletions base/revocable_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_REVOCABLE_STORE_H__
#define BASE_REVOCABLE_STORE_H__
#ifndef BASE_REVOCABLE_STORE_H_
#define BASE_REVOCABLE_STORE_H_

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/ref_counted.h"

// |RevocableStore| is a container of items that can be removed from the store.
Expand Down Expand Up @@ -73,5 +71,4 @@ class RevocableStore {
DISALLOW_EVIL_CONSTRUCTORS(RevocableStore);
};

#endif // BASE_REVOCABLE_STORE_H__

#endif // BASE_REVOCABLE_STORE_H_
11 changes: 3 additions & 8 deletions base/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef BASE_TASK_H__
#define BASE_TASK_H__
#ifndef BASE_TASK_H_
#define BASE_TASK_H_

#include <set>

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/non_thread_safe.h"
#include "base/revocable_store.h"
#include "base/time.h"
#include "base/tracked.h"
#include "base/tuple.h"

Expand Down Expand Up @@ -667,5 +663,4 @@ class UnboundMethod {
Params p_;
};

#endif // BASE_TASK_H__

#endif // BASE_TASK_H_
2 changes: 2 additions & 0 deletions chrome/browser/autocomplete/search_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "chrome/common/pref_service.h"
#include "googleurl/src/url_util.h"
#include "net/base/escape.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"

#include "generated_resources.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/automation/automation_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "chrome/views/window.h"
#include "chrome/test/automation/automation_messages.h"
#include "net/base/cookie_monster.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_filter.h"

using base::Time;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/automation/url_request_mock_http_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "net/base/net_util.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_filter.h"

static const char kMockHostname[] = "mock.http";
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/automation/url_request_slow_download_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_filter.h"

Expand Down
11 changes: 4 additions & 7 deletions chrome/browser/chrome_plugin_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

#include "base/command_line.h"
#include "base/file_util.h"
#include "base/gfx/png_encoder.h"
#include "base/histogram.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/perftimer.h"
#include "base/singleton.h"
#include "base/string_util.h"
#include "net/base/cookie_monster.h"
#include "net/url_request/url_request_error_job.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/chrome_plugin_browsing_context.h"
#include "chrome/browser/chrome_thread.h"
Expand All @@ -37,12 +36,10 @@
#include "chrome/common/net/url_request_intercept_job.h"
#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"

#include "base/gfx/png_encoder.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/base64.h"
#include "net/base/cookie_monster.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_error_job.h"
#include "skia/include/SkBitmap.h"

using base::TimeDelta;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/debugger/debugger_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/command_line.h"
#include "base/file_util.h"
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/debugger/debugger_contents.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/dom_ui/dom_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/json_reader.h"
#include "base/json_writer.h"
#include "base/string_util.h"
#include "base/values.h"
#include "chrome/common/l10n_util.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/external_protocol_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/message_loop.h"
#include "base/registry.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/thread.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_process_impl.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/google_url_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_status.h"

const char GoogleURLTracker::kDefaultGoogleHomepage[] =
"http://www.google.com/";
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/google_url_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/notification_observer.h"
#include "googleurl/src/gurl.h"

class PrefService;

Expand Down
9 changes: 4 additions & 5 deletions chrome/browser/ime_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_IME_INPUT_H__
#define CHROME_BROWSER_IME_INPUT_H__
#ifndef CHROME_BROWSER_IME_INPUT_H_
#define CHROME_BROWSER_IME_INPUT_H_

#include <windows.h>

#include <string>

#include "base/basictypes.h"
#include "base/gfx/Rect.h"
#include "base/gfx/rect.h"

// This header file defines a struct and a class used for encapsulating IMM32
// APIs, controls IMEs attached to a window, and enables the 'on-the-spot'
Expand Down Expand Up @@ -303,5 +303,4 @@ class ImeInput {
DISALLOW_EVIL_CONSTRUCTORS(ImeInput);
};

#endif // #ifndef CHROME_BROWSER_IME_INPUT_H__

#endif // #ifndef CHROME_BROWSER_IME_INPUT_H_
1 change: 1 addition & 0 deletions chrome/browser/jsmessage_box_handler_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chrome/browser/jsmessage_box_handler_win.h"

#include "base/string_util.h"
#include "chrome/browser/app_modal_dialog_queue.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profile.h"
Expand Down
8 changes: 0 additions & 8 deletions chrome/browser/memory_details.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@
#include <psapi.h>

#include "base/file_version_info.h"
#include "base/histogram.h"
#include "base/image_util.h"
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
#include "base/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/child_process_host.h"

Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/memory_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
#ifndef CHROME_BROWSER_MEMORY_DETAILS_H_
#define CHROME_BROWSER_MEMORY_DETAILS_H_


#include <string>
#include <vector>

#include "base/file_path.h"
#include "base/process_util.h"
#include "base/ref_counted.h"
#include "chrome/common/child_process_info.h"
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/net/dns_global.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
#include "net/base/dns_resolution_observer.h"

using base::TimeDelta;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/dns_master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "chrome/browser/net/dns_master.h"

#include <sstream>
#include <set>

#include "base/histogram.h"
#include "base/stats_counters.h"
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/net/sdch_dictionary_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// found in the LICENSE file.

#include "chrome/browser/net/sdch_dictionary_fetcher.h"

#include "chrome/browser/profile.h"
#include "net/url_request/url_request_status.h"

void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) {
// Avoid pushing duplicate copy onto queue. We may fetch this url again later
Expand Down
113 changes: 113 additions & 0 deletions chrome/browser/net/url_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,87 @@
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
#include "net/base/io_buffer.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"

static const int kBufferSize = 4096;

class URLFetcher::Core
: public base::RefCountedThreadSafe<URLFetcher::Core>,
public URLRequest::Delegate {
public:
// For POST requests, set |content_type| to the MIME type of the content
// and set |content| to the data to upload. |flags| are flags to apply to
// the load operation--these should be one or more of the LOAD_* flags
// defined in url_request.h.
Core(URLFetcher* fetcher,
const GURL& original_url,
RequestType request_type,
URLFetcher::Delegate* d);

// Starts the load. It's important that this not happen in the constructor
// because it causes the IO thread to begin AddRef()ing and Release()ing
// us. If our caller hasn't had time to fully construct us and take a
// reference, the IO thread could interrupt things, run a task, Release()
// us, and destroy us, leaving the caller with an already-destroyed object
// when construction finishes.
void Start();

// Stops any in-progress load and ensures no callback will happen. It is
// safe to call this multiple times.
void Stop();

// URLRequest::Delegate implementations
virtual void OnReceivedRedirect(URLRequest* request,
const GURL& new_url) { }
virtual void OnResponseStarted(URLRequest* request);
virtual void OnReadCompleted(URLRequest* request, int bytes_read);

private:
// Wrapper functions that allow us to ensure actions happen on the right
// thread.
void StartURLRequest();
void CancelURLRequest();
void OnCompletedURLRequest(const URLRequestStatus& status);

URLFetcher* fetcher_; // Corresponding fetcher object
GURL original_url_; // The URL we were asked to fetch
GURL url_; // The URL we eventually wound up at
RequestType request_type_; // What type of request is this?
URLFetcher::Delegate* delegate_; // Object to notify on completion
MessageLoop* delegate_loop_; // Message loop of the creating thread
MessageLoop* io_loop_; // Message loop of the IO thread
URLRequest* request_; // The actual request this wraps
int load_flags_; // Flags for the load operation
int response_code_; // HTTP status code for the request
std::string data_; // Results of the request
scoped_refptr<net::IOBuffer> buffer_;
// Read buffer
scoped_refptr<URLRequestContext> request_context_;
// Cookie/cache info for the request
ResponseCookies cookies_; // Response cookies
std::string extra_request_headers_;// Extra headers for the request, if any
scoped_refptr<net::HttpResponseHeaders> response_headers_;

std::string upload_content_; // HTTP POST payload
std::string upload_content_type_; // MIME type of POST payload

// The overload protection entry for this URL. This is used to
// incrementally back off how rapidly we'll send requests to a particular
// URL, to avoid placing too much demand on the remote resource. We update
// this with the status of all requests as they return, and in turn use it
// to determine how long to wait before making another request.
URLFetcherProtectEntry* protect_entry_;
// |num_retries_| indicates how many times we've failed to successfully
// fetch this URL. Once this value exceeds the maximum number of retries
// specified by the protection manager, we'll give up.
int num_retries_;

friend class URLFetcher;
DISALLOW_COPY_AND_ASSIGN(Core);
};

URLFetcher::URLFetcher(const GURL& url,
RequestType request_type,
Delegate* d)
Expand Down Expand Up @@ -184,3 +262,38 @@ void URLFetcher::Core::OnCompletedURLRequest(const URLRequestStatus& status) {
cookies_, data_);
}
}

void URLFetcher::set_io_loop(MessageLoop* io_loop) {
core_->io_loop_ = io_loop;
}

void URLFetcher::set_upload_data(const std::string& upload_content_type,
const std::string& upload_content) {
core_->upload_content_type_ = upload_content_type;
core_->upload_content_ = upload_content;
}

void URLFetcher::set_load_flags(int load_flags) {
core_->load_flags_ = load_flags;
}

void URLFetcher::set_extra_request_headers(
const std::string& extra_request_headers) {
core_->extra_request_headers_ = extra_request_headers;
}

void URLFetcher::set_request_context(URLRequestContext* request_context) {
core_->request_context_ = request_context;
}

net::HttpResponseHeaders* URLFetcher::response_headers() const {
return core_->response_headers_;
}

void URLFetcher::Start() {
core_->Start();
}

const GURL& URLFetcher::url() const {
return core_->url_;
}
Loading

0 comments on commit 319d9e6

Please sign in to comment.