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

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

Issue 6576020: Remove Gears from Chrome (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove host_render_view_id Created 9 years, 9 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) 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 "chrome/common/resource_dispatcher.h" 7 #include "chrome/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"
(...skipping 22 matching lines...) Expand all
33 return next_request_id++; 33 return next_request_id++;
34 } 34 }
35 35
36 // ResourceLoaderBridge implementation ---------------------------------------- 36 // ResourceLoaderBridge implementation ----------------------------------------
37 37
38 namespace webkit_glue { 38 namespace webkit_glue {
39 39
40 class IPCResourceLoaderBridge : public ResourceLoaderBridge { 40 class IPCResourceLoaderBridge : public ResourceLoaderBridge {
41 public: 41 public:
42 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher, 42 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher,
43 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, 43 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info);
44 int host_renderer_id,
45 int host_render_view_id);
46 virtual ~IPCResourceLoaderBridge(); 44 virtual ~IPCResourceLoaderBridge();
47 45
48 // ResourceLoaderBridge 46 // ResourceLoaderBridge
49 virtual void AppendDataToUpload(const char* data, int data_len); 47 virtual void AppendDataToUpload(const char* data, int data_len);
50 virtual void AppendFileRangeToUpload( 48 virtual void AppendFileRangeToUpload(
51 const FilePath& path, 49 const FilePath& path,
52 uint64 offset, 50 uint64 offset,
53 uint64 length, 51 uint64 length,
54 const base::Time& expected_modification_time); 52 const base::Time& expected_modification_time);
55 virtual void AppendBlobToUpload(const GURL& blob_url); 53 virtual void AppendBlobToUpload(const GURL& blob_url);
(...skipping 12 matching lines...) Expand all
68 66
69 // The request to send, created on initialization for modification and 67 // The request to send, created on initialization for modification and
70 // appending data. 68 // appending data.
71 ViewHostMsg_Resource_Request request_; 69 ViewHostMsg_Resource_Request request_;
72 70
73 // ID for the request, valid once Start()ed, -1 if not valid yet. 71 // ID for the request, valid once Start()ed, -1 if not valid yet.
74 int request_id_; 72 int request_id_;
75 73
76 // The routing id used when sending IPC messages. 74 // The routing id used when sending IPC messages.
77 int routing_id_; 75 int routing_id_;
78
79 // The following two members are specified if the request is initiated by
80 // a plugin like Gears.
81
82 // Contains the id of the host renderer.
83 int host_renderer_id_;
84
85 // Contains the id of the host render view.
86 int host_render_view_id_;
87 }; 76 };
88 77
89 IPCResourceLoaderBridge::IPCResourceLoaderBridge( 78 IPCResourceLoaderBridge::IPCResourceLoaderBridge(
90 ResourceDispatcher* dispatcher, 79 ResourceDispatcher* dispatcher,
91 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, 80 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info)
92 int host_renderer_id,
93 int host_render_view_id)
94 : peer_(NULL), 81 : peer_(NULL),
95 dispatcher_(dispatcher), 82 dispatcher_(dispatcher),
96 request_id_(-1), 83 request_id_(-1),
97 routing_id_(request_info.routing_id), 84 routing_id_(request_info.routing_id) {
98 host_renderer_id_(host_renderer_id),
99 host_render_view_id_(host_render_view_id) {
100 DCHECK(dispatcher_) << "no resource dispatcher"; 85 DCHECK(dispatcher_) << "no resource dispatcher";
101 request_.method = request_info.method; 86 request_.method = request_info.method;
102 request_.url = request_info.url; 87 request_.url = request_info.url;
103 request_.first_party_for_cookies = request_info.first_party_for_cookies; 88 request_.first_party_for_cookies = request_info.first_party_for_cookies;
104 request_.referrer = request_info.referrer; 89 request_.referrer = request_info.referrer;
105 request_.headers = request_info.headers; 90 request_.headers = request_info.headers;
106 request_.load_flags = request_info.load_flags; 91 request_.load_flags = request_info.load_flags;
107 request_.origin_pid = request_info.requestor_pid; 92 request_.origin_pid = request_info.requestor_pid;
108 request_.resource_type = request_info.request_type; 93 request_.resource_type = request_info.request_type;
109 request_.request_context = request_info.request_context; 94 request_.request_context = request_info.request_context;
110 request_.appcache_host_id = request_info.appcache_host_id; 95 request_.appcache_host_id = request_info.appcache_host_id;
111 request_.download_to_file = request_info.download_to_file; 96 request_.download_to_file = request_info.download_to_file;
112 request_.has_user_gesture = request_info.has_user_gesture; 97 request_.has_user_gesture = request_info.has_user_gesture;
113 request_.host_renderer_id = host_renderer_id_;
114 request_.host_render_view_id = host_render_view_id_;
115 } 98 }
116 99
117 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() { 100 IPCResourceLoaderBridge::~IPCResourceLoaderBridge() {
118 // we remove our hook for the resource dispatcher only when going away, since 101 // we remove our hook for the resource dispatcher only when going away, since
119 // it doesn't keep track of whether we've force terminated the request 102 // it doesn't keep track of whether we've force terminated the request
120 if (request_id_ >= 0) { 103 if (request_id_ >= 0) {
121 // this operation may fail, as the dispatcher will have preemptively 104 // this operation may fail, as the dispatcher will have preemptively
122 // removed us when the renderer sends the ReceivedAllData message. 105 // removed us when the renderer sends the ReceivedAllData message.
123 dispatcher_->RemovePendingRequest(request_id_); 106 dispatcher_->RemovePendingRequest(request_id_);
124 107
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 PendingRequestInfo& pending_request = index->second; 537 PendingRequestInfo& pending_request = index->second;
555 if (pending_request.is_deferred) { 538 if (pending_request.is_deferred) {
556 pending_request.deferred_message_queue.swap(q); 539 pending_request.deferred_message_queue.swap(q);
557 return; 540 return;
558 } 541 }
559 } 542 }
560 } 543 }
561 } 544 }
562 545
563 webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge( 546 webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
564 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, 547 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
565 int host_renderer_id, 548 return new webkit_glue::IPCResourceLoaderBridge(this, request_info);
566 int host_render_view_id) {
567 return new webkit_glue::IPCResourceLoaderBridge(this, request_info,
568 host_renderer_id,
569 host_render_view_id);
570 } 549 }
571 550
572 bool ResourceDispatcher::IsResourceDispatcherMessage( 551 bool ResourceDispatcher::IsResourceDispatcherMessage(
573 const IPC::Message& message) { 552 const IPC::Message& message) {
574 switch (message.type()) { 553 switch (message.type()) {
575 case ViewMsg_Resource_UploadProgress::ID: 554 case ViewMsg_Resource_UploadProgress::ID:
576 case ViewMsg_Resource_ReceivedResponse::ID: 555 case ViewMsg_Resource_ReceivedResponse::ID:
577 case ViewMsg_Resource_ReceivedCachedMetadata::ID: 556 case ViewMsg_Resource_ReceivedCachedMetadata::ID:
578 case ViewMsg_Resource_ReceivedRedirect::ID: 557 case ViewMsg_Resource_ReceivedRedirect::ID:
579 case ViewMsg_Resource_DataReceived::ID: 558 case ViewMsg_Resource_DataReceived::ID:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 591
613 // static 592 // static
614 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { 593 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
615 while (!queue->empty()) { 594 while (!queue->empty()) {
616 IPC::Message* message = queue->front(); 595 IPC::Message* message = queue->front();
617 ReleaseResourcesInDataMessage(*message); 596 ReleaseResourcesInDataMessage(*message);
618 queue->pop_front(); 597 queue->pop_front();
619 delete message; 598 delete message;
620 } 599 }
621 } 600 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698