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

Unified Diff: ppapi/proxy/ppb_url_request_info_proxy.cc

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_url_loader_proxy.cc ('k') | ppapi/proxy/ppb_url_response_info_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_url_request_info_proxy.cc
===================================================================
--- ppapi/proxy/ppb_url_request_info_proxy.cc (revision 71973)
+++ ppapi/proxy/ppb_url_request_info_proxy.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,7 @@
class URLRequestInfo : public PluginResource {
public:
- URLRequestInfo() {}
+ URLRequestInfo(PP_Instance instance) : PluginResource(instance) {}
virtual ~URLRequestInfo() {}
// Resource overrides.
@@ -26,14 +26,26 @@
namespace {
+// Returns the dispatcher associated with the given URLRequestInfo, or NULL if
+// none exists.
+PluginDispatcher* DispatcherFromURLRequestInfo(PP_Resource resource) {
+ URLRequestInfo* object = PluginResource::GetAs<URLRequestInfo>(resource);
+ if (!object)
+ return NULL;
+ return PluginDispatcher::GetForInstance(object->instance());
+}
+
PP_Resource Create(PP_Instance instance) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
+ if (!dispatcher)
+ return 0;
+
PP_Resource result;
- PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBURLRequestInfo_Create(
+ dispatcher->Send(new PpapiHostMsg_PPBURLRequestInfo_Create(
INTERFACE_ID_PPB_URL_REQUEST_INFO, instance, &result));
if (result) {
- linked_ptr<URLRequestInfo> object(new URLRequestInfo);
- PluginDispatcher::Get()->plugin_resource_tracker()->AddResource(
- result, object);
+ linked_ptr<URLRequestInfo> object(new URLRequestInfo(instance));
+ PluginResourceTracker::GetInstance()->AddResource(result, object);
}
return result;
}
@@ -46,7 +58,10 @@
PP_Bool SetProperty(PP_Resource request_id,
PP_URLRequestProperty property,
PP_Var var) {
- Dispatcher* dispatcher = PluginDispatcher::Get();
+ PluginDispatcher* dispatcher = DispatcherFromURLRequestInfo(request_id);
+ if (!dispatcher)
+ return PP_FALSE;
+
dispatcher->Send(new PpapiHostMsg_PPBURLRequestInfo_SetProperty(
INTERFACE_ID_PPB_URL_REQUEST_INFO, request_id,
static_cast<int32_t>(property),
@@ -59,11 +74,13 @@
PP_Bool AppendDataToBody(PP_Resource request_id,
const char* data, uint32_t len) {
- PluginDispatcher::Get()->Send(
- new PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody(
- INTERFACE_ID_PPB_URL_REQUEST_INFO, request_id,
- std::string(data, len)));
+ PluginDispatcher* dispatcher = DispatcherFromURLRequestInfo(request_id);
+ if (!dispatcher)
+ return PP_FALSE;
+ dispatcher->Send(new PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody(
+ INTERFACE_ID_PPB_URL_REQUEST_INFO, request_id, std::string(data, len)));
+
// TODO(brettw) do some validation. We should be able to tell on the plugin
// side whether the request will succeed or fail in the renderer.
return PP_TRUE;
@@ -74,11 +91,14 @@
int64_t start_offset,
int64_t number_of_bytes,
PP_Time expected_last_modified_time) {
- PluginDispatcher::Get()->Send(
- new PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody(
- INTERFACE_ID_PPB_URL_REQUEST_INFO, request_id, file_ref_id,
- start_offset, number_of_bytes, expected_last_modified_time));
+ PluginDispatcher* dispatcher = DispatcherFromURLRequestInfo(request_id);
+ if (!dispatcher)
+ return PP_FALSE;
+ dispatcher->Send(new PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody(
+ INTERFACE_ID_PPB_URL_REQUEST_INFO, request_id, file_ref_id,
+ start_offset, number_of_bytes, expected_last_modified_time));
+
// TODO(brettw) do some validation. We should be able to tell on the plugin
// side whether the request will succeed or fail in the renderer.
return PP_TRUE;
« no previous file with comments | « ppapi/proxy/ppb_url_loader_proxy.cc ('k') | ppapi/proxy/ppb_url_response_info_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698