| OLD | NEW |
| 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/browser/appcache/appcache_dispatcher_host.h" | 5 #include "chrome/browser/appcache/appcache_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/appcache/chrome_appcache_service.h" | 8 #include "chrome/browser/appcache/chrome_appcache_service.h" |
| 9 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 9 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 10 #include "chrome/browser/net/chrome_url_request_context.h" | 10 #include "chrome/browser/net/chrome_url_request_context.h" |
| 11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 12 | 12 |
| 13 AppCacheDispatcherHost::AppCacheDispatcherHost( | 13 AppCacheDispatcherHost::AppCacheDispatcherHost( |
| 14 URLRequestContext* request_context) | 14 URLRequestContext* request_context) |
| 15 : request_context_(request_context), | 15 : request_context_(request_context), |
| 16 receiver_(NULL) { | 16 receiver_(NULL) { |
| 17 DCHECK(request_context_.get()); | 17 DCHECK(request_context_.get()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 AppCacheDispatcherHost::AppCacheDispatcherHost( | 20 AppCacheDispatcherHost::AppCacheDispatcherHost( |
| 21 URLRequestContextGetter* request_context_getter) | 21 URLRequestContextGetter* request_context_getter) |
| 22 : request_context_getter_(request_context_getter), | 22 : request_context_getter_(request_context_getter), |
| 23 receiver_(NULL) { | 23 receiver_(NULL) { |
| 24 DCHECK(request_context_getter_.get()); | 24 DCHECK(request_context_getter_.get()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 AppCacheDispatcherHost::~AppCacheDispatcherHost() {} |
| 28 |
| 27 void AppCacheDispatcherHost::Initialize( | 29 void AppCacheDispatcherHost::Initialize( |
| 28 ResourceDispatcherHost::Receiver* receiver) { | 30 ResourceDispatcherHost::Receiver* receiver) { |
| 29 DCHECK(receiver && !receiver_); | 31 DCHECK(receiver && !receiver_); |
| 30 DCHECK(request_context_.get() || request_context_getter_.get()); | 32 DCHECK(request_context_.get() || request_context_getter_.get()); |
| 31 | 33 |
| 32 receiver_ = receiver; | 34 receiver_ = receiver; |
| 33 | 35 |
| 34 // Get the AppCacheService (it can only be accessed from IO thread). | 36 // Get the AppCacheService (it can only be accessed from IO thread). |
| 35 URLRequestContext* context = request_context_.get(); | 37 URLRequestContext* context = request_context_.get(); |
| 36 if (!context) | 38 if (!context) |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); | 229 AppCacheMsg_SwapCache::WriteReplyParams(reply_msg, result); |
| 228 frontend_proxy_.sender()->Send(pending_reply_msg_.release()); | 230 frontend_proxy_.sender()->Send(pending_reply_msg_.release()); |
| 229 } | 231 } |
| 230 | 232 |
| 231 void AppCacheDispatcherHost::ReceivedBadMessage(uint32 msg_type) { | 233 void AppCacheDispatcherHost::ReceivedBadMessage(uint32 msg_type) { |
| 232 // TODO(michaeln): Consider gathering UMA stats | 234 // TODO(michaeln): Consider gathering UMA stats |
| 233 // http://code.google.com/p/chromium/issues/detail?id=24634 | 235 // http://code.google.com/p/chromium/issues/detail?id=24634 |
| 234 BrowserRenderProcessHost::BadMessageTerminateProcess( | 236 BrowserRenderProcessHost::BadMessageTerminateProcess( |
| 235 msg_type, receiver_->handle()); | 237 msg_type, receiver_->handle()); |
| 236 } | 238 } |
| OLD | NEW |