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

Side by Side Diff: chrome/renderer/webplugin_delegate_proxy.cc

Issue 435044: Send resource load notifications from plugins to devtools agent (Closed)
Patch Set: Sync with trunk Created 11 years 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
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.h ('k') | webkit/glue/plugins/plugin_instance.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) 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/renderer/webplugin_delegate_proxy.h" 5 #include "chrome/renderer/webplugin_delegate_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/gfx/blit.h" 9 #include "app/gfx/blit.h"
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 public: 61 public:
62 ResourceClientProxy(PluginChannelHost* channel, int instance_id) 62 ResourceClientProxy(PluginChannelHost* channel, int instance_id)
63 : channel_(channel), instance_id_(instance_id), resource_id_(0), 63 : channel_(channel), instance_id_(instance_id), resource_id_(0),
64 notify_needed_(false), notify_data_(0), 64 notify_needed_(false), notify_data_(0),
65 multibyte_response_expected_(false) { 65 multibyte_response_expected_(false) {
66 } 66 }
67 67
68 ~ResourceClientProxy() { 68 ~ResourceClientProxy() {
69 } 69 }
70 70
71 void Initialize(int resource_id, const GURL& url, bool notify_needed, 71 void Initialize(unsigned long resource_id, const GURL& url,
72 intptr_t notify_data, intptr_t existing_stream) { 72 bool notify_needed, intptr_t notify_data,
73 intptr_t existing_stream) {
73 resource_id_ = resource_id; 74 resource_id_ = resource_id;
74 url_ = url; 75 url_ = url;
75 notify_needed_ = notify_needed; 76 notify_needed_ = notify_needed;
76 notify_data_ = notify_data; 77 notify_data_ = notify_data;
77 78
78 PluginMsg_URLRequestReply_Params params; 79 PluginMsg_URLRequestReply_Params params;
79 params.resource_id = resource_id; 80 params.resource_id = resource_id;
80 params.url = url_; 81 params.url = url_;
81 params.notify_needed = notify_needed_; 82 params.notify_needed = notify_needed_;
82 params.notify_data = notify_data_; 83 params.notify_data = notify_data_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 141 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
141 } 142 }
142 143
143 bool IsMultiByteResponseExpected() { 144 bool IsMultiByteResponseExpected() {
144 return multibyte_response_expected_; 145 return multibyte_response_expected_;
145 } 146 }
146 147
147 private: 148 private:
148 scoped_refptr<PluginChannelHost> channel_; 149 scoped_refptr<PluginChannelHost> channel_;
149 int instance_id_; 150 int instance_id_;
150 int resource_id_; 151 unsigned long resource_id_;
151 GURL url_; 152 GURL url_;
152 bool notify_needed_; 153 bool notify_needed_;
153 intptr_t notify_data_; 154 intptr_t notify_data_;
154 // Set to true if the response expected is a multibyte response. 155 // Set to true if the response expected is a multibyte response.
155 // For e.g. response for a HTTP byte range request. 156 // For e.g. response for a HTTP byte range request.
156 bool multibyte_response_expected_; 157 bool multibyte_response_expected_;
157 }; 158 };
158 159
159 WebPluginDelegateProxy::WebPluginDelegateProxy( 160 WebPluginDelegateProxy::WebPluginDelegateProxy(
160 const std::string& mime_type, 161 const std::string& mime_type,
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 plugin_->HandleURLRequest(params.method.c_str(), 1119 plugin_->HandleURLRequest(params.method.c_str(),
1119 params.is_javascript_url, target, 1120 params.is_javascript_url, target,
1120 static_cast<unsigned int>(params.buffer.size()), 1121 static_cast<unsigned int>(params.buffer.size()),
1121 data, params.is_file_data, params.notify, 1122 data, params.is_file_data, params.notify,
1122 params.url.c_str(), params.notify_data, 1123 params.url.c_str(), params.notify_data,
1123 params.popups_allowed); 1124 params.popups_allowed);
1124 } 1125 }
1125 1126
1126 webkit_glue::WebPluginResourceClient* 1127 webkit_glue::WebPluginResourceClient*
1127 WebPluginDelegateProxy::CreateResourceClient( 1128 WebPluginDelegateProxy::CreateResourceClient(
1128 int resource_id, const GURL& url, bool notify_needed, 1129 unsigned long resource_id, const GURL& url, bool notify_needed,
1129 intptr_t notify_data, intptr_t npstream) { 1130 intptr_t notify_data, intptr_t npstream) {
1130 if (!channel_host_) 1131 if (!channel_host_)
1131 return NULL; 1132 return NULL;
1132 1133
1133 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, 1134 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_,
1134 instance_id_); 1135 instance_id_);
1135 proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream); 1136 proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream);
1136 return proxy; 1137 return proxy;
1137 } 1138 }
1138 1139
1139 void WebPluginDelegateProxy::OnCancelDocumentLoad() { 1140 void WebPluginDelegateProxy::OnCancelDocumentLoad() {
1140 plugin_->CancelDocumentLoad(); 1141 plugin_->CancelDocumentLoad();
1141 } 1142 }
1142 1143
1143 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( 1144 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest(
1144 const std::string& url, const std::string& range_info, 1145 const std::string& url, const std::string& range_info,
1145 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { 1146 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) {
1146 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), 1147 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
1147 existing_stream, notify_needed, 1148 existing_stream, notify_needed,
1148 notify_data); 1149 notify_data);
1149 } 1150 }
1150 1151
1151 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, 1152 void WebPluginDelegateProxy::OnDeferResourceLoading(unsigned long resource_id,
1152 bool defer) { 1153 bool defer) {
1153 plugin_->SetDeferResourceLoading(resource_id, defer); 1154 plugin_->SetDeferResourceLoading(resource_id, defer);
1154 } 1155 }
1155 1156
1156 #if defined(OS_MACOSX) 1157 #if defined(OS_MACOSX)
1157 void WebPluginDelegateProxy::OnUpdateGeometry_ACK(int ack_key) { 1158 void WebPluginDelegateProxy::OnUpdateGeometry_ACK(int ack_key) {
1158 DCHECK_NE(ack_key, -1); 1159 DCHECK_NE(ack_key, -1);
1159 1160
1160 OldTransportDIBMap::iterator iterator = old_transport_dibs_.find(ack_key); 1161 OldTransportDIBMap::iterator iterator = old_transport_dibs_.find(ack_key);
1161 1162
1162 // DCHECK_NE does not work with base::hash_map. 1163 // DCHECK_NE does not work with base::hash_map.
1163 DCHECK(iterator != old_transport_dibs_.end()); 1164 DCHECK(iterator != old_transport_dibs_.end());
1164 1165
1165 // Now that the ACK has been received, the TransportDIBs that were used 1166 // Now that the ACK has been received, the TransportDIBs that were used
1166 // prior to the UpdateGeometry message now being acknowledged are known to 1167 // prior to the UpdateGeometry message now being acknowledged are known to
1167 // be no longer needed. Release them, and take the stale entry out of the 1168 // be no longer needed. Release them, and take the stale entry out of the
1168 // map. 1169 // map.
1169 ReleaseTransportDIB(iterator->second.backing_store.get()); 1170 ReleaseTransportDIB(iterator->second.backing_store.get());
1170 ReleaseTransportDIB(iterator->second.transport_store.get()); 1171 ReleaseTransportDIB(iterator->second.transport_store.get());
1171 ReleaseTransportDIB(iterator->second.background_store.get()); 1172 ReleaseTransportDIB(iterator->second.background_store.get());
1172 1173
1173 old_transport_dibs_.erase(iterator); 1174 old_transport_dibs_.erase(iterator);
1174 } 1175 }
1175 #endif 1176 #endif
OLDNEW
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698