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

Side by Side Diff: ppapi/cpp/module.cc

Issue 7038044: First step to remove scripting from PPP_Instance and PPB_Instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 7 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/cpp/instance.cc ('k') | webkit/glue/webkit_glue.gypi » ('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 // Note that the single accessor, Module::Get(), is not actually implemented 5 // Note that the single accessor, Module::Get(), is not actually implemented
6 // in this file. This is an intentional hook that allows users of ppapi's 6 // in this file. This is an intentional hook that allows users of ppapi's
7 // C++ wrapper objects to provide difference semantics for how the singleton 7 // C++ wrapper objects to provide difference semantics for how the singleton
8 // object is accessed. 8 // object is accessed.
9 // 9 //
10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which 10 // In general, users of ppapi will also link in ppp_entrypoints.cc, which
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 Module* module_singleton = Module::Get(); 108 Module* module_singleton = Module::Get();
109 if (!module_singleton) 109 if (!module_singleton)
110 return PP_FALSE; 110 return PP_FALSE;
111 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 111 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
112 if (!instance) 112 if (!instance)
113 return PP_FALSE; 113 return PP_FALSE;
114 return BoolToPPBool( 114 return BoolToPPBool(
115 instance->HandleDocumentLoad(URLLoader(pp_url_loader))); 115 instance->HandleDocumentLoad(URLLoader(pp_url_loader)));
116 } 116 }
117 117
118 #ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING
118 PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) { 119 PP_Var Instance_GetInstanceObject(PP_Instance pp_instance) {
119 Module* module_singleton = Module::Get(); 120 Module* module_singleton = Module::Get();
120 if (!module_singleton) 121 if (!module_singleton)
121 return Var().Detach(); 122 return Var().Detach();
122 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 123 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
123 if (!instance) 124 if (!instance)
124 return Var().Detach(); 125 return Var().Detach();
125 return instance->GetInstanceObject().Detach(); 126 return instance->GetInstanceObject().Detach();
126 } 127 }
128 #endif
127 129
128 static PPP_Instance instance_interface = { 130 static PPP_Instance instance_interface = {
129 &Instance_DidCreate, 131 &Instance_DidCreate,
130 &Instance_DidDestroy, 132 &Instance_DidDestroy,
131 &Instance_DidChangeView, 133 &Instance_DidChangeView,
132 &Instance_DidChangeFocus, 134 &Instance_DidChangeFocus,
133 &Instance_HandleInputEvent, 135 &Instance_HandleInputEvent,
134 &Instance_HandleDocumentLoad, 136 &Instance_HandleDocumentLoad,
137 #ifndef PPAPI_INSTANCE_REMOVE_SCRIPTING
135 &Instance_GetInstanceObject 138 &Instance_GetInstanceObject
139 #endif
136 }; 140 };
137 141
138 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) { 142 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) {
139 Module* module_singleton = Module::Get(); 143 Module* module_singleton = Module::Get();
140 if (!module_singleton) 144 if (!module_singleton)
141 return; 145 return;
142 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); 146 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance);
143 if (!instance) 147 if (!instance)
144 return; 148 return;
145 instance->HandleMessage(Var(Var::PassRef(), var)); 149 instance->HandleMessage(Var(Var::PassRef(), var));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( 217 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface(
214 PPB_CORE_INTERFACE)); 218 PPB_CORE_INTERFACE));
215 if (!core) 219 if (!core)
216 return false; 220 return false;
217 core_ = new Core(core); 221 core_ = new Core(core);
218 222
219 return Init(); 223 return Init();
220 } 224 }
221 225
222 } // namespace pp 226 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/instance.cc ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698