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

Side by Side Diff: chrome/common/appcache/appcache_dispatcher_host.cc

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/common/appcache/appcache_dispatcher_host.h" 5 #include "chrome/common/appcache/appcache_dispatcher_host.h"
6 6
7 #include "chrome/browser/renderer_host/browser_render_process_host.h" 7 #include "chrome/browser/renderer_host/browser_render_process_host.h"
8 // TODO(eroman): uh oh, depending on stuff outside of common/
9 #include "chrome/browser/net/chrome_url_request_context.h"
8 #include "chrome/common/appcache/chrome_appcache_service.h" 10 #include "chrome/common/appcache/chrome_appcache_service.h"
9 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
10 12
11 AppCacheDispatcherHost::AppCacheDispatcherHost( 13 AppCacheDispatcherHost::AppCacheDispatcherHost(
12 ChromeAppCacheService* appcache_service) 14 URLRequestContextGetter* request_context_getter)
13 : appcache_service_(appcache_service), 15 : request_context_getter_(request_context_getter),
14 process_handle_(0) { 16 process_handle_(0) {
15 } 17 }
16 18
17 void AppCacheDispatcherHost::Initialize(IPC::Message::Sender* sender, 19 void AppCacheDispatcherHost::Initialize(IPC::Message::Sender* sender,
18 int process_id, base::ProcessHandle process_handle) { 20 int process_id, base::ProcessHandle process_handle) {
19 DCHECK(sender); 21 DCHECK(sender);
20 DCHECK(process_handle && !process_handle_); 22 DCHECK(process_handle && !process_handle_);
21 process_handle_ = process_handle; 23 process_handle_ = process_handle;
24
25 // Get the AppCacheService (it can only be accessed from IO thread).
26 URLRequestContext* context = request_context_getter_->GetURLRequestContext();
27 appcache_service_ =
28 static_cast<ChromeURLRequestContext*>(context)->appcache_service();
29 request_context_getter_ = NULL;
30
22 frontend_proxy_.set_sender(sender); 31 frontend_proxy_.set_sender(sender);
23 if (appcache_service_.get()) { 32 if (appcache_service_.get()) {
24 backend_impl_.Initialize( 33 backend_impl_.Initialize(
25 appcache_service_.get(), &frontend_proxy_, process_id); 34 appcache_service_.get(), &frontend_proxy_, process_id);
26 get_status_callback_.reset( 35 get_status_callback_.reset(
27 NewCallback(this, &AppCacheDispatcherHost::GetStatusCallback)); 36 NewCallback(this, &AppCacheDispatcherHost::GetStatusCallback));
28 start_update_callback_.reset( 37 start_update_callback_.reset(
29 NewCallback(this, &AppCacheDispatcherHost::StartUpdateCallback)); 38 NewCallback(this, &AppCacheDispatcherHost::StartUpdateCallback));
30 swap_cache_callback_.reset( 39 swap_cache_callback_.reset(
31 NewCallback(this, &AppCacheDispatcherHost::SwapCacheCallback)); 40 NewCallback(this, &AppCacheDispatcherHost::SwapCacheCallback));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); 183 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result);
175 frontend_proxy_.sender()->Send(pending_reply_msg_.release()); 184 frontend_proxy_.sender()->Send(pending_reply_msg_.release());
176 } 185 }
177 186
178 void AppCacheDispatcherHost::ReceivedBadMessage(uint16 msg_type) { 187 void AppCacheDispatcherHost::ReceivedBadMessage(uint16 msg_type) {
179 // TODO(michaeln): Consider gathering UMA stats 188 // TODO(michaeln): Consider gathering UMA stats
180 // http://code.google.com/p/chromium/issues/detail?id=24634 189 // http://code.google.com/p/chromium/issues/detail?id=24634
181 BrowserRenderProcessHost::BadMessageTerminateProcess( 190 BrowserRenderProcessHost::BadMessageTerminateProcess(
182 msg_type, process_handle_); 191 msg_type, process_handle_);
183 } 192 }
OLDNEW
« no previous file with comments | « chrome/common/appcache/appcache_dispatcher_host.h ('k') | chrome/common/appcache/chrome_appcache_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698