summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 20:25:57 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-02 20:25:57 +0000
commit6c0dabc62c20fecb61d6de75fed7b40b16214a2c (patch)
treed5211083667642b1d4b0b714527b612535d8257b /chrome/browser/automation
parent15d7d60c7b6541a6adef5e953c92429e703c77fa (diff)
downloadchromium_src-6c0dabc62c20fecb61d6de75fed7b40b16214a2c.zip
chromium_src-6c0dabc62c20fecb61d6de75fed7b40b16214a2c.tar.gz
chromium_src-6c0dabc62c20fecb61d6de75fed7b40b16214a2c.tar.bz2
Sixth patch in getting rid of caching MessageLoop pointers.
BUG=25354 Review URL: http://codereview.chromium.org/354002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.cc28
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.h2
2 files changed, 14 insertions, 16 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index c06eb66..eb3edf3 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "base/histogram.h"
-#include "base/message_loop.h"
#include "base/path_service.h"
#include "chrome/browser/automation/url_request_automation_job.h"
#include "chrome/browser/net/url_request_failed_dns_job.h"
@@ -14,11 +13,11 @@
#include "chrome/browser/net/url_request_slow_download_job.h"
#include "chrome/browser/net/url_request_slow_http_job.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/test/automation/automation_messages.h"
#include "net/url_request/url_request_filter.h"
-MessageLoop* AutomationResourceMessageFilter::io_loop_ = NULL;
AutomationResourceMessageFilter::RenderViewMap
AutomationResourceMessageFilter::filtered_render_views_;
int AutomationResourceMessageFilter::unique_request_id_ = 1;
@@ -35,7 +34,6 @@ AutomationResourceMessageFilter::~AutomationResourceMessageFilter() {
void AutomationResourceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
DCHECK(channel_ == NULL);
channel_ = channel;
- io_loop_ = MessageLoop::current();
}
// Called on the IPC thread:
@@ -94,7 +92,7 @@ bool AutomationResourceMessageFilter::OnMessageReceived(
// Called on the IPC thread:
bool AutomationResourceMessageFilter::Send(IPC::Message* message) {
// This has to be called on the IO thread.
- DCHECK_EQ(io_loop_, MessageLoop::current());
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
if (!channel_) {
delete message;
return false;
@@ -110,7 +108,7 @@ bool AutomationResourceMessageFilter::RegisterRequest(
return false;
}
- DCHECK_EQ(io_loop_, MessageLoop::current());
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
DCHECK(request_map_.end() == request_map_.find(job->id()));
request_map_[job->id()] = job;
return true;
@@ -118,7 +116,7 @@ bool AutomationResourceMessageFilter::RegisterRequest(
void AutomationResourceMessageFilter::UnRegisterRequest(
URLRequestAutomationJob* job) {
- DCHECK_EQ(io_loop_, MessageLoop::current());
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
DCHECK(request_map_.find(job->id()) != request_map_.end());
request_map_.erase(job->id());
}
@@ -131,19 +129,21 @@ bool AutomationResourceMessageFilter::RegisterRenderView(
return false;
}
- DCHECK(io_loop_);
- io_loop_->PostTask(FROM_HERE, NewRunnableFunction(
- AutomationResourceMessageFilter::RegisterRenderViewInIOThread,
- renderer_pid, renderer_id, tab_handle, filter));
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableFunction(
+ AutomationResourceMessageFilter::RegisterRenderViewInIOThread,
+ renderer_pid, renderer_id, tab_handle, filter));
return true;
}
void AutomationResourceMessageFilter::UnRegisterRenderView(
int renderer_pid, int renderer_id) {
- DCHECK(io_loop_);
- io_loop_->PostTask(FROM_HERE, NewRunnableFunction(
- AutomationResourceMessageFilter::UnRegisterRenderViewInIOThread,
- renderer_pid, renderer_id));
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableFunction(
+ AutomationResourceMessageFilter::UnRegisterRenderViewInIOThread,
+ renderer_pid, renderer_id));
}
void AutomationResourceMessageFilter::RegisterRenderViewInIOThread(
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h
index b209085..beb5fa8 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -13,7 +13,6 @@
#include "ipc/ipc_channel_proxy.h"
class URLRequestAutomationJob;
-class MessageLoop;
// This class filters out incoming automation IPC messages for network
// requests and processes them on the IPC thread. As a result, network
@@ -98,7 +97,6 @@ class AutomationResourceMessageFilter
// The channel associated with the automation connection. This pointer is not
// owned by this class.
IPC::Channel* channel_;
- static MessageLoop* io_loop_;
// A unique request id per process.
static int unique_request_id_;