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

Side by Side Diff: ppapi/proxy/ppp_instance_proxy.cc

Issue 8333004: Rename InterfaceID to ApiID and move the file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years, 2 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/ppp_instance_private_proxy.cc ('k') | ppapi/proxy/ppp_messaging_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) 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 #include "ppapi/proxy/ppp_instance_proxy.h" 5 #include "ppapi/proxy/ppp_instance_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ppapi/c/pp_var.h" 9 #include "ppapi/c/pp_var.h"
10 #include "ppapi/c/ppb_core.h" 10 #include "ppapi/c/ppb_core.h"
(...skipping 17 matching lines...) Expand all
28 const char* argv[]) { 28 const char* argv[]) {
29 std::vector<std::string> argn_vect; 29 std::vector<std::string> argn_vect;
30 std::vector<std::string> argv_vect; 30 std::vector<std::string> argv_vect;
31 for (uint32_t i = 0; i < argc; i++) { 31 for (uint32_t i = 0; i < argc; i++) {
32 argn_vect.push_back(std::string(argn[i])); 32 argn_vect.push_back(std::string(argn[i]));
33 argv_vect.push_back(std::string(argv[i])); 33 argv_vect.push_back(std::string(argv[i]));
34 } 34 }
35 35
36 PP_Bool result = PP_FALSE; 36 PP_Bool result = PP_FALSE;
37 HostDispatcher::GetForInstance(instance)->Send( 37 HostDispatcher::GetForInstance(instance)->Send(
38 new PpapiMsg_PPPInstance_DidCreate(INTERFACE_ID_PPP_INSTANCE, instance, 38 new PpapiMsg_PPPInstance_DidCreate(API_ID_PPP_INSTANCE, instance,
39 argn_vect, argv_vect, &result)); 39 argn_vect, argv_vect, &result));
40 return result; 40 return result;
41 } 41 }
42 42
43 void DidDestroy(PP_Instance instance) { 43 void DidDestroy(PP_Instance instance) {
44 HostDispatcher::GetForInstance(instance)->Send( 44 HostDispatcher::GetForInstance(instance)->Send(
45 new PpapiMsg_PPPInstance_DidDestroy(INTERFACE_ID_PPP_INSTANCE, instance)); 45 new PpapiMsg_PPPInstance_DidDestroy(API_ID_PPP_INSTANCE, instance));
46 } 46 }
47 47
48 void DidChangeView(PP_Instance instance, 48 void DidChangeView(PP_Instance instance,
49 const PP_Rect* position, 49 const PP_Rect* position,
50 const PP_Rect* clip) { 50 const PP_Rect* clip) {
51 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 51 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
52 const PPB_FlashFullscreen* fullscreen_interface = 52 const PPB_FlashFullscreen* fullscreen_interface =
53 static_cast<const PPB_FlashFullscreen*>( 53 static_cast<const PPB_FlashFullscreen*>(
54 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); 54 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
55 DCHECK(fullscreen_interface); 55 DCHECK(fullscreen_interface);
56 const PPB_FlashFullscreen* flash_fullscreen_interface = 56 const PPB_FlashFullscreen* flash_fullscreen_interface =
57 static_cast<const PPB_FlashFullscreen*>( 57 static_cast<const PPB_FlashFullscreen*>(
58 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); 58 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE));
59 DCHECK(flash_fullscreen_interface); 59 DCHECK(flash_fullscreen_interface);
60 PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance); 60 PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance);
61 PP_Bool flash_fullscreen = 61 PP_Bool flash_fullscreen =
62 flash_fullscreen_interface->IsFullscreen(instance); 62 flash_fullscreen_interface->IsFullscreen(instance);
63 dispatcher->Send( 63 dispatcher->Send(
64 new PpapiMsg_PPPInstance_DidChangeView(INTERFACE_ID_PPP_INSTANCE, 64 new PpapiMsg_PPPInstance_DidChangeView(API_ID_PPP_INSTANCE,
65 instance, *position, *clip, 65 instance, *position, *clip,
66 fullscreen, 66 fullscreen,
67 flash_fullscreen)); 67 flash_fullscreen));
68 } 68 }
69 69
70 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { 70 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {
71 HostDispatcher::GetForInstance(instance)->Send( 71 HostDispatcher::GetForInstance(instance)->Send(
72 new PpapiMsg_PPPInstance_DidChangeFocus(INTERFACE_ID_PPP_INSTANCE, 72 new PpapiMsg_PPPInstance_DidChangeFocus(API_ID_PPP_INSTANCE,
73 instance, has_focus)); 73 instance, has_focus));
74 } 74 }
75 75
76 PP_Bool HandleDocumentLoad(PP_Instance instance, 76 PP_Bool HandleDocumentLoad(PP_Instance instance,
77 PP_Resource url_loader) { 77 PP_Resource url_loader) {
78 PP_Bool result = PP_FALSE; 78 PP_Bool result = PP_FALSE;
79 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 79 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
80 80
81 // Set up the URLLoader for proxying. 81 // Set up the URLLoader for proxying.
82 82
83 PPB_URLLoader_Proxy* url_loader_proxy = static_cast<PPB_URLLoader_Proxy*>( 83 PPB_URLLoader_Proxy* url_loader_proxy = static_cast<PPB_URLLoader_Proxy*>(
84 dispatcher->GetInterfaceProxy(INTERFACE_ID_PPB_URL_LOADER)); 84 dispatcher->GetInterfaceProxy(API_ID_PPB_URL_LOADER));
85 url_loader_proxy->PrepareURLLoaderForSendingToPlugin(url_loader); 85 url_loader_proxy->PrepareURLLoaderForSendingToPlugin(url_loader);
86 86
87 // PluginResourceTracker in the plugin process assumes that resources that it 87 // PluginResourceTracker in the plugin process assumes that resources that it
88 // tracks have been addrefed on behalf of the plugin at the renderer side. So 88 // tracks have been addrefed on behalf of the plugin at the renderer side. So
89 // we explicitly do it for |url_loader| here. 89 // we explicitly do it for |url_loader| here.
90 // 90 //
91 // Please also see comments in PPP_Instance_Proxy::OnMsgHandleDocumentLoad() 91 // Please also see comments in PPP_Instance_Proxy::OnMsgHandleDocumentLoad()
92 // about releasing of this extra reference. 92 // about releasing of this extra reference.
93 const PPB_Core* core = reinterpret_cast<const PPB_Core*>( 93 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(
94 dispatcher->local_get_interface()(PPB_CORE_INTERFACE)); 94 dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
95 if (!core) { 95 if (!core) {
96 NOTREACHED(); 96 NOTREACHED();
97 return PP_FALSE; 97 return PP_FALSE;
98 } 98 }
99 core->AddRefResource(url_loader); 99 core->AddRefResource(url_loader);
100 100
101 HostResource serialized_loader; 101 HostResource serialized_loader;
102 serialized_loader.SetHostResource(instance, url_loader); 102 serialized_loader.SetHostResource(instance, url_loader);
103 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 103 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
104 INTERFACE_ID_PPP_INSTANCE, instance, serialized_loader, &result)); 104 API_ID_PPP_INSTANCE, instance, serialized_loader, &result));
105 return result; 105 return result;
106 } 106 }
107 107
108 static const PPP_Instance_1_0 instance_interface_1_0 = { 108 static const PPP_Instance_1_0 instance_interface_1_0 = {
109 &DidCreate, 109 &DidCreate,
110 &DidDestroy, 110 &DidDestroy,
111 &DidChangeView, 111 &DidChangeView,
112 &DidChangeFocus, 112 &DidChangeFocus,
113 &HandleDocumentLoad 113 &HandleDocumentLoad
114 }; 114 };
(...skipping 14 matching lines...) Expand all
129 } 129 }
130 130
131 PPP_Instance_Proxy::~PPP_Instance_Proxy() { 131 PPP_Instance_Proxy::~PPP_Instance_Proxy() {
132 } 132 }
133 133
134 // static 134 // static
135 const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() { 135 const InterfaceProxy::Info* PPP_Instance_Proxy::GetInfo1_0() {
136 static const Info info = { 136 static const Info info = {
137 &instance_interface_1_0, 137 &instance_interface_1_0,
138 PPP_INSTANCE_INTERFACE_1_0, 138 PPP_INSTANCE_INTERFACE_1_0,
139 INTERFACE_ID_PPP_INSTANCE, 139 API_ID_PPP_INSTANCE,
140 false, 140 false,
141 &CreateInstanceProxy 141 &CreateInstanceProxy
142 }; 142 };
143 return &info; 143 return &info;
144 } 144 }
145 145
146 bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { 146 bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
147 bool handled = true; 147 bool handled = true;
148 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg) 148 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg)
149 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate, 149 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // with. The plugin will normally take an additional reference which will keep 234 // with. The plugin will normally take an additional reference which will keep
235 // the resource alive in the plugin (and the one reference in the renderer 235 // the resource alive in the plugin (and the one reference in the renderer
236 // representing all plugin references). 236 // representing all plugin references).
237 // Once all references at the plugin side are released, the renderer side will 237 // Once all references at the plugin side are released, the renderer side will
238 // be notified and release the reference added in HandleDocumentLoad() above. 238 // be notified and release the reference added in HandleDocumentLoad() above.
239 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader); 239 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader);
240 } 240 }
241 241
242 } // namespace proxy 242 } // namespace proxy
243 } // namespace ppapi 243 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_instance_private_proxy.cc ('k') | ppapi/proxy/ppp_messaging_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698