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

Side by Side Diff: content/common/resource_dispatcher.cc

Issue 7058041: Remove ResourceDispatcherHost dependency on Chrome's LoginHandler and ExternalProtocolHandler. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix deps Created 9 years, 6 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
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/common/resource_dispatcher.h" 7 #include "content/common/resource_dispatcher.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "content/common/resource_dispatcher_delegate.h"
15 #include "content/common/resource_messages.h" 16 #include "content/common/resource_messages.h"
16 #include "content/common/resource_response.h" 17 #include "content/common/resource_response.h"
17 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
18 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
19 #include "net/base/upload_data.h" 20 #include "net/base/upload_data.h"
20 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
21 #include "webkit/glue/resource_type.h" 22 #include "webkit/glue/resource_type.h"
22 23
23 // Each resource request is assigned an ID scoped to this process. 24 // Each resource request is assigned an ID scoped to this process.
24 static int MakeRequestID() { 25 static int MakeRequestID() {
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 response->load_timing = result.load_timing; 219 response->load_timing = result.load_timing;
219 response->devtools_info = result.devtools_info; 220 response->devtools_info = result.devtools_info;
220 response->data.swap(result.data); 221 response->data.swap(result.data);
221 response->download_file_path = result.download_file_path; 222 response->download_file_path = result.download_file_path;
222 } 223 }
223 224
224 } // namespace webkit_glue 225 } // namespace webkit_glue
225 226
226 // ResourceDispatcher --------------------------------------------------------- 227 // ResourceDispatcher ---------------------------------------------------------
227 228
228 ResourceDispatcher::Observer::Observer() {
229 }
230
231 ResourceDispatcher::Observer::~Observer() {
232 }
233
234 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) 229 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender)
235 : message_sender_(sender), 230 : message_sender_(sender),
236 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 231 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
232 delegate_(NULL) {
237 } 233 }
238 234
239 ResourceDispatcher::~ResourceDispatcher() { 235 ResourceDispatcher::~ResourceDispatcher() {
240 } 236 }
241 237
242 // ResourceDispatcher implementation ------------------------------------------ 238 // ResourceDispatcher implementation ------------------------------------------
243 239
244 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) { 240 bool ResourceDispatcher::OnMessageReceived(const IPC::Message& message) {
245 if (!IsResourceDispatcherMessage(message)) { 241 if (!IsResourceDispatcherMessage(message)) {
246 return false; 242 return false;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 message_sender()->Send( 302 message_sender()->Send(
307 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id)); 303 new ResourceHostMsg_UploadProgress_ACK(message.routing_id(), request_id));
308 } 304 }
309 305
310 void ResourceDispatcher::OnReceivedResponse( 306 void ResourceDispatcher::OnReceivedResponse(
311 int request_id, const ResourceResponseHead& response_head) { 307 int request_id, const ResourceResponseHead& response_head) {
312 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 308 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
313 if (!request_info) 309 if (!request_info)
314 return; 310 return;
315 311
316 if (observer_.get()) { 312 if (delegate_) {
317 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 313 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
318 observer_->OnReceivedResponse( 314 delegate_->OnReceivedResponse(
319 request_info->peer, response_head.mime_type, request_info->url); 315 request_info->peer, response_head.mime_type, request_info->url);
320 if (new_peer) 316 if (new_peer)
321 request_info->peer = new_peer; 317 request_info->peer = new_peer;
322 } 318 }
323 319
324 request_info->peer->OnReceivedResponse(response_head); 320 request_info->peer->OnReceivedResponse(response_head);
325 } 321 }
326 322
327 void ResourceDispatcher::OnReceivedCachedMetadata( 323 void ResourceDispatcher::OnReceivedCachedMetadata(
328 int request_id, const std::vector<char>& data) { 324 int request_id, const std::vector<char>& data) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 void ResourceDispatcher::OnRequestComplete(int request_id, 410 void ResourceDispatcher::OnRequestComplete(int request_id,
415 const net::URLRequestStatus& status, 411 const net::URLRequestStatus& status,
416 const std::string& security_info, 412 const std::string& security_info,
417 const base::Time& completion_time) { 413 const base::Time& completion_time) {
418 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); 414 PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
419 if (!request_info) 415 if (!request_info)
420 return; 416 return;
421 417
422 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer; 418 webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer;
423 419
424 if (observer_.get()) { 420 if (delegate_) {
425 webkit_glue::ResourceLoaderBridge::Peer* new_peer = 421 webkit_glue::ResourceLoaderBridge::Peer* new_peer =
426 observer_->OnRequestComplete( 422 delegate_->OnRequestComplete(
427 request_info->peer, request_info->resource_type, status); 423 request_info->peer, request_info->resource_type, status);
428 if (new_peer) 424 if (new_peer)
429 request_info->peer = new_peer; 425 request_info->peer = new_peer;
430 } 426 }
431 427
432 // The request ID will be removed from our pending list in the destructor. 428 // The request ID will be removed from our pending list in the destructor.
433 // Normally, dispatching this message causes the reference-counted request to 429 // Normally, dispatching this message causes the reference-counted request to
434 // die immediately. 430 // die immediately.
435 peer->OnCompletedRequest(status, security_info, completion_time); 431 peer->OnCompletedRequest(status, security_info, completion_time);
436 } 432 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 582
587 // static 583 // static
588 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 584 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
589 while (!queue->empty()) { 585 while (!queue->empty()) {
590 IPC::Message* message = queue->front(); 586 IPC::Message* message = queue->front();
591 ReleaseResourcesInDataMessage(*message); 587 ReleaseResourcesInDataMessage(*message);
592 queue->pop_front(); 588 queue->pop_front();
593 delete message; 589 delete message;
594 } 590 }
595 } 591 }
OLDNEW
« no previous file with comments | « content/common/resource_dispatcher.h ('k') | content/common/resource_dispatcher_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698