diff options
Diffstat (limited to 'chrome')
18 files changed, 31 insertions, 27 deletions
diff --git a/chrome/browser/browser_thread.h b/chrome/browser/browser_thread.h index c034851..f6a022e 100644 --- a/chrome/browser/browser_thread.h +++ b/chrome/browser/browser_thread.h @@ -109,7 +109,7 @@ class BrowserThread : public base::Thread { template <class T> static bool DeleteSoon(ID identifier, const tracked_objects::Location& from_here, - T* object) { + const T* object) { return PostNonNestableTask( identifier, from_here, new DeleteTask<T>(object)); } @@ -117,7 +117,7 @@ class BrowserThread : public base::Thread { template <class T> static bool ReleaseSoon(ID identifier, const tracked_objects::Location& from_here, - T* object) { + const T* object) { return PostNonNestableTask( identifier, from_here, new ReleaseTask<T>(object)); } @@ -154,7 +154,7 @@ class BrowserThread : public base::Thread { template<ID thread> struct DeleteOnThread { template<typename T> - static void Destruct(T* x) { + static void Destruct(const T* x) { if (CurrentlyOn(thread)) { delete x; } else { diff --git a/chrome/browser/browser_thread_unittest.cc b/chrome/browser/browser_thread_unittest.cc index d2c19d8..948709a 100644 --- a/chrome/browser/browser_thread_unittest.cc +++ b/chrome/browser/browser_thread_unittest.cc @@ -11,7 +11,7 @@ class BrowserThreadTest : public testing::Test { public: - void Release() { + void Release() const { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); loop_.PostTask(FROM_HERE, new MessageLoop::QuitTask); } @@ -77,7 +77,9 @@ class BrowserThreadTest : public testing::Test { private: scoped_ptr<BrowserThread> ui_thread_; scoped_ptr<BrowserThread> file_thread_; - MessageLoop loop_; + // It's kind of ugly to make this mutable - solely so we can post the Quit + // Task from Release(). This should be fixed. + mutable MessageLoop loop_; }; TEST_F(BrowserThreadTest, PostTask) { diff --git a/chrome/browser/chrome_plugin_unittest.cc b/chrome/browser/chrome_plugin_unittest.cc index 38b4bd5..a7eee5b 100644 --- a/chrome/browser/chrome_plugin_unittest.cc +++ b/chrome/browser/chrome_plugin_unittest.cc @@ -33,7 +33,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { context_ = new TestURLRequestContext(); return context_; } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index e59e00e..0abe211 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -609,7 +609,7 @@ net::CookieStore* ChromeURLRequestContextGetter::GetCookieStore() { } scoped_refptr<base::MessageLoopProxy> -ChromeURLRequestContextGetter::GetIOMessageLoopProxy() { +ChromeURLRequestContextGetter::GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index a580282..43b1b21 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -240,7 +240,7 @@ class ChromeURLRequestContextGetter : public URLRequestContextGetter, // URLRequestContextGetter implementation. virtual URLRequestContext* GetURLRequestContext(); virtual net::CookieStore* GetCookieStore(); - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy(); + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; // Convenience overload of GetURLRequestContext() that returns a // ChromeURLRequestContext* rather than a URLRequestContext*. diff --git a/chrome/browser/renderer_host/pepper_file_message_filter.cc b/chrome/browser/renderer_host/pepper_file_message_filter.cc index e7b331b..cbd09af 100644 --- a/chrome/browser/renderer_host/pepper_file_message_filter.cc +++ b/chrome/browser/renderer_host/pepper_file_message_filter.cc @@ -104,7 +104,7 @@ void PepperFileMessageFilter::OnMessageReceivedFileThread( } } -void PepperFileMessageFilter::OnDestruct() { +void PepperFileMessageFilter::OnDestruct() const { BrowserThread::DeleteOnIOThread::Destruct(this); } diff --git a/chrome/browser/renderer_host/pepper_file_message_filter.h b/chrome/browser/renderer_host/pepper_file_message_filter.h index 37e57f6..003d258 100644 --- a/chrome/browser/renderer_host/pepper_file_message_filter.h +++ b/chrome/browser/renderer_host/pepper_file_message_filter.h @@ -37,7 +37,7 @@ class PepperFileMessageFilter : public IPC::ChannelProxy::MessageFilter { virtual void OnChannelError(); virtual void OnChannelClosing(); virtual bool OnMessageReceived(const IPC::Message& message); - virtual void OnDestruct(); + virtual void OnDestruct() const; // Called from the FILE thread. void Send(IPC::Message* message); diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index a5f4f5e..5c853e9 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -524,7 +524,7 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) { return handled; } -void ResourceMessageFilter::OnDestruct() { +void ResourceMessageFilter::OnDestruct() const { BrowserThread::DeleteOnIOThread::Destruct(this); } diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index fa1932e..399a122 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -107,7 +107,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, virtual void OnChannelError(); virtual void OnChannelClosing(); virtual bool OnMessageReceived(const IPC::Message& message); - virtual void OnDestruct(); + virtual void OnDestruct() const; // ResourceDispatcherHost::Receiver methods: virtual bool Send(IPC::Message* message); diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc index 3adaaf0..044cc75 100644 --- a/chrome/browser/sync/glue/http_bridge.cc +++ b/chrome/browser/sync/glue/http_bridge.cc @@ -44,7 +44,7 @@ URLRequestContext* HttpBridge::RequestContextGetter::GetURLRequestContext() { } scoped_refptr<base::MessageLoopProxy> -HttpBridge::RequestContextGetter::GetIOMessageLoopProxy() { +HttpBridge::RequestContextGetter::GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h index 1951ce5..5b9d4b2 100644 --- a/chrome/browser/sync/glue/http_bridge.h +++ b/chrome/browser/sync/glue/http_bridge.h @@ -85,7 +85,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, // URLRequestContextGetter implementation. virtual URLRequestContext* GetURLRequestContext(); - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy(); + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; private: ~RequestContextGetter() {} diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc index dc4948d..eac7c32 100644 --- a/chrome/browser/sync/glue/http_bridge_unittest.cc +++ b/chrome/browser/sync/glue/http_bridge_unittest.cc @@ -26,7 +26,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { context_ = new TestURLRequestContext; return context_; } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } diff --git a/chrome/common/net/url_fetcher_unittest.cc b/chrome/common/net/url_fetcher_unittest.cc index 3fc8469..512f38b 100644 --- a/chrome/common/net/url_fetcher_unittest.cc +++ b/chrome/common/net/url_fetcher_unittest.cc @@ -34,7 +34,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { context_ = new TestURLRequestContext(); return context_; } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return io_message_loop_proxy_; } @@ -199,7 +199,7 @@ class CancelTestURLRequestContextGetter : public URLRequestContextGetter { } return context_; } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return io_message_loop_proxy_; } void WaitForContextCreation() { diff --git a/chrome/common/net/url_request_context_getter.cc b/chrome/common/net/url_request_context_getter.cc index 57feb0e..08b5368 100644 --- a/chrome/common/net/url_request_context_getter.cc +++ b/chrome/common/net/url_request_context_getter.cc @@ -14,7 +14,7 @@ URLRequestContextGetter::URLRequestContextGetter() : is_main_(false) {} URLRequestContextGetter::~URLRequestContextGetter() {} -void URLRequestContextGetter::OnDestruct() { +void URLRequestContextGetter::OnDestruct() const { scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = GetIOMessageLoopProxy(); DCHECK(io_message_loop_proxy); diff --git a/chrome/common/net/url_request_context_getter.h b/chrome/common/net/url_request_context_getter.h index 2b6ea82..ade5e1a 100644 --- a/chrome/common/net/url_request_context_getter.h +++ b/chrome/common/net/url_request_context_getter.h @@ -33,7 +33,8 @@ class URLRequestContextGetter // Returns a MessageLoopProxy corresponding to the thread on which the // request IO happens (the thread on which the returned URLRequestContext // may be used). - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() = 0; + virtual scoped_refptr<base::MessageLoopProxy> + GetIOMessageLoopProxy() const = 0; // Controls whether or not the URLRequestContextGetter considers itself to be // the the "main" URLRequestContextGetter. Note that each Profile will have a @@ -44,7 +45,7 @@ class URLRequestContextGetter void set_is_main(bool is_main) { is_main_ = is_main; } protected: - friend class DeleteTask<URLRequestContextGetter>; + friend class DeleteTask<const URLRequestContextGetter>; friend struct URLRequestContextGetterTraits; URLRequestContextGetter(); @@ -55,7 +56,7 @@ class URLRequestContextGetter private: // OnDestruct is meant to ensure deletion on the thread on which the request // IO happens. - void OnDestruct(); + void OnDestruct() const; // Indicates whether or not this is the default URLRequestContextGetter for // the main Profile. @@ -63,7 +64,7 @@ class URLRequestContextGetter }; struct URLRequestContextGetterTraits { - static void Destruct(URLRequestContextGetter* context_getter) { + static void Destruct(const URLRequestContextGetter* context_getter) { context_getter->OnDestruct(); } }; diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index 3f264a4..8e5ae02 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -64,14 +64,15 @@ ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() g_service_process->io_thread()->message_loop_proxy()) { } -URLRequestContext* ServiceURLRequestContextGetter::GetURLRequestContext() { +URLRequestContext* +ServiceURLRequestContextGetter::GetURLRequestContext() { if (!url_request_context_) url_request_context_ = new ServiceURLRequestContext(); return url_request_context_; } scoped_refptr<base::MessageLoopProxy> -ServiceURLRequestContextGetter::GetIOMessageLoopProxy() { +ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const { return io_message_loop_proxy_; } diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h index 379371f..46a8b2a 100644 --- a/chrome/service/net/service_url_request_context.h +++ b/chrome/service/net/service_url_request_context.h @@ -59,7 +59,7 @@ class ServiceURLRequestContextGetter : public URLRequestContextGetter { ServiceURLRequestContextGetter(); virtual URLRequestContext* GetURLRequestContext(); - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy(); + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const; void set_user_agent(const std::string& ua) { user_agent_ = ua; diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 4de6143..829fcc9 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -122,7 +122,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { context_ = new TestURLRequestContext(); return context_.get(); } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } @@ -147,7 +147,7 @@ class TestExtensionURLRequestContextGetter : public URLRequestContextGetter { context_ = new TestExtensionURLRequestContext(); return context_.get(); } - virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { + virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const { return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } |