Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/automation/automation_profile_impl.cc

Issue 342020: First of several patches to get rid of MessageLoop caching now that we have C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/automation_profile_impl.h" 5 #include "chrome/browser/automation/automation_profile_impl.h"
6 #include "chrome/browser/chrome_thread.h"
6 #include "chrome/browser/net/chrome_url_request_context.h" 7 #include "chrome/browser/net/chrome_url_request_context.h"
7 #include "chrome/test/automation/automation_messages.h" 8 #include "chrome/test/automation/automation_messages.h"
8 9
9 namespace { 10 namespace {
10 11
11 // A special Request context for automation. Substitute a few things 12 // A special Request context for automation. Substitute a few things
12 // like cookie store, proxy settings etc to handle them differently 13 // like cookie store, proxy settings etc to handle them differently
13 // for automation. 14 // for automation.
14 class AutomationURLRequestContext : public ChromeURLRequestContext { 15 class AutomationURLRequestContext : public ChromeURLRequestContext {
15 public: 16 public:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_; 143 scoped_refptr<ChromeURLRequestContextGetter> original_context_getter_;
143 AutomationProfileImpl* profile_; 144 AutomationProfileImpl* profile_;
144 IPC::Message::Sender* automation_client_; 145 IPC::Message::Sender* automation_client_;
145 }; 146 };
146 147
147 // TODO(eroman): This duplicates CleanupRequestContext() from profile.cc. 148 // TODO(eroman): This duplicates CleanupRequestContext() from profile.cc.
148 void CleanupRequestContext(ChromeURLRequestContextGetter* context) { 149 void CleanupRequestContext(ChromeURLRequestContextGetter* context) {
149 context->CleanupOnUIThread(); 150 context->CleanupOnUIThread();
150 151
151 // Clean up request context on IO thread. 152 // Clean up request context on IO thread.
152 g_browser_process->io_thread()->message_loop()->ReleaseSoon(FROM_HERE, 153 ChromeThread::ReleaseSoon(ChromeThread::IO, FROM_HERE, context);
153 context);
154 } 154 }
155 155
156 } // namespace 156 } // namespace
157 157
158 AutomationProfileImpl::~AutomationProfileImpl() { 158 AutomationProfileImpl::~AutomationProfileImpl() {
159 CleanupRequestContext(alternate_request_context_); 159 CleanupRequestContext(alternate_request_context_);
160 } 160 }
161 161
162 void AutomationProfileImpl::Initialize(Profile* original_profile, 162 void AutomationProfileImpl::Initialize(Profile* original_profile,
163 IPC::Message::Sender* automation_client) { 163 IPC::Message::Sender* automation_client) {
164 DCHECK(original_profile); 164 DCHECK(original_profile);
165 original_profile_ = original_profile; 165 original_profile_ = original_profile;
166 166
167 ChromeURLRequestContextGetter* original_context = 167 ChromeURLRequestContextGetter* original_context =
168 static_cast<ChromeURLRequestContextGetter*>( 168 static_cast<ChromeURLRequestContextGetter*>(
169 original_profile_->GetRequestContext()); 169 original_profile_->GetRequestContext());
170 alternate_request_context_ = new ChromeURLRequestContextGetter( 170 alternate_request_context_ = new ChromeURLRequestContextGetter(
171 NULL, // Don't register an observer on PrefService. 171 NULL, // Don't register an observer on PrefService.
172 new Factory(original_context, this, automation_client)); 172 new Factory(original_context, this, automation_client));
173 alternate_request_context_->AddRef(); // Balananced in the destructor. 173 alternate_request_context_->AddRef(); // Balananced in the destructor.
174 } 174 }
175 175
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698