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

Side by Side Diff: ppapi/proxy/ppb_url_response_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_url_response_info_proxy.h ('k') | ppapi/proxy/ppb_var_deprecated_proxy.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "ppapi/proxy/ppb_url_response_info_proxy.h" 5 #include "ppapi/proxy/ppb_url_response_info_proxy.h"
6 6
7 #include "ppapi/c/ppb_url_response_info.h" 7 #include "ppapi/c/ppb_url_response_info.h"
8 #include "ppapi/proxy/plugin_dispatcher.h" 8 #include "ppapi/proxy/plugin_dispatcher.h"
9 #include "ppapi/proxy/plugin_resource.h" 9 #include "ppapi/proxy/plugin_resource.h"
10 #include "ppapi/proxy/ppapi_messages.h" 10 #include "ppapi/proxy/ppapi_messages.h"
11 #include "ppapi/proxy/serialized_var.h" 11 #include "ppapi/proxy/serialized_var.h"
12 12
13 namespace pp { 13 namespace pp {
14 namespace proxy { 14 namespace proxy {
15 15
16 class URLResponseInfo : public PluginResource { 16 class URLResponseInfo : public PluginResource {
17 public: 17 public:
18 URLResponseInfo() {} 18 URLResponseInfo(PP_Instance instance) : PluginResource(instance) {}
19 virtual ~URLResponseInfo() {} 19 virtual ~URLResponseInfo() {}
20 20
21 // Resource overrides. 21 // Resource overrides.
22 virtual URLResponseInfo* AsURLResponseInfo() { return this; } 22 virtual URLResponseInfo* AsURLResponseInfo() { return this; }
23 23
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(URLResponseInfo); 25 DISALLOW_COPY_AND_ASSIGN(URLResponseInfo);
26 }; 26 };
27 27
28 namespace { 28 namespace {
29 29
30 PP_Bool IsURLResponseInfo(PP_Resource resource) { 30 PP_Bool IsURLResponseInfo(PP_Resource resource) {
31 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(resource); 31 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(resource);
32 return BoolToPPBool(!!object); 32 return BoolToPPBool(!!object);
33 } 33 }
34 34
35 PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty property) { 35 PP_Var GetProperty(PP_Resource response, PP_URLResponseProperty property) {
36 Dispatcher* dispatcher = PluginDispatcher::Get(); 36 URLResponseInfo* object = PluginResource::GetAs<URLResponseInfo>(response);
37 if (!object)
38 return PP_MakeUndefined();
39 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
40 object->instance());
41 if (!dispatcher)
42 return PP_MakeUndefined();
43
37 ReceiveSerializedVarReturnValue result; 44 ReceiveSerializedVarReturnValue result;
38 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty( 45 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetProperty(
39 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, property, &result)); 46 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, property, &result));
40 return result.Return(dispatcher); 47 return result.Return(dispatcher);
41 } 48 }
42 49
43 PP_Resource GetBodyAsFileRef(PP_Resource response) { 50 PP_Resource GetBodyAsFileRef(PP_Resource response) {
44 PP_Resource result = 0; 51 PP_Resource result = 0;
45 /* 52 /*
46 Dispatcher* dispatcher = PluginDispatcher::Get();
47 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( 53 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef(
48 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, &result)); 54 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, &result));
49 // TODO(brettw) when we have FileRef proxied, make an object from that 55 // TODO(brettw) when we have FileRef proxied, make an object from that
50 // ref so we can track it properly and then uncomment this. 56 // ref so we can track it properly and then uncomment this.
51 */ 57 */
52 return result; 58 return result;
53 } 59 }
54 60
55 const PPB_URLResponseInfo ppb_urlresponseinfo = { 61 const PPB_URLResponseInfo ppb_urlresponseinfo = {
56 &IsURLResponseInfo, 62 &IsURLResponseInfo,
57 &GetProperty, 63 &GetProperty,
58 &GetBodyAsFileRef 64 &GetBodyAsFileRef
59 }; 65 };
60 66
61 } // namespace 67 } // namespace
62 68
63 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy( 69 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy(
64 Dispatcher* dispatcher, 70 Dispatcher* dispatcher,
65 const void* target_interface) 71 const void* target_interface)
66 : InterfaceProxy(dispatcher, target_interface) { 72 : InterfaceProxy(dispatcher, target_interface) {
67 } 73 }
68 74
69 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() { 75 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() {
70 } 76 }
71 77
72 // static 78 // static
73 void PPB_URLResponseInfo_Proxy::TrackPluginResource( 79 void PPB_URLResponseInfo_Proxy::TrackPluginResource(
80 PP_Instance instance,
74 PP_Resource response_resource) { 81 PP_Resource response_resource) {
75 linked_ptr<URLResponseInfo> object(new URLResponseInfo); 82 linked_ptr<URLResponseInfo> object(new URLResponseInfo(instance));
76 PluginDispatcher::Get()->plugin_resource_tracker()->AddResource( 83 PluginResourceTracker::GetInstance()->AddResource(
77 response_resource, object); 84 response_resource, object);
78 } 85 }
79 86
80 const void* PPB_URLResponseInfo_Proxy::GetSourceInterface() const { 87 const void* PPB_URLResponseInfo_Proxy::GetSourceInterface() const {
81 return &ppb_urlresponseinfo; 88 return &ppb_urlresponseinfo;
82 } 89 }
83 90
84 InterfaceID PPB_URLResponseInfo_Proxy::GetInterfaceId() const { 91 InterfaceID PPB_URLResponseInfo_Proxy::GetInterfaceId() const {
85 return INTERFACE_ID_PPB_URL_RESPONSE_INFO; 92 return INTERFACE_ID_PPB_URL_RESPONSE_INFO;
86 } 93 }
(...skipping 20 matching lines...) Expand all
107 } 114 }
108 115
109 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( 116 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef(
110 PP_Resource response, 117 PP_Resource response,
111 PP_Resource* file_ref_result) { 118 PP_Resource* file_ref_result) {
112 *file_ref_result = ppb_url_response_info_target()->GetBodyAsFileRef(response); 119 *file_ref_result = ppb_url_response_info_target()->GetBodyAsFileRef(response);
113 } 120 }
114 121
115 } // namespace proxy 122 } // namespace proxy
116 } // namespace pp 123 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_url_response_info_proxy.h ('k') | ppapi/proxy/ppb_var_deprecated_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698