OLD | NEW |
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 // PPP_Messaging implementation ------------------------------------------------ | 132 // PPP_Messaging implementation ------------------------------------------------ |
133 | 133 |
134 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) { | 134 void Messaging_HandleMessage(PP_Instance pp_instance, PP_Var var) { |
135 Module* module_singleton = Module::Get(); | 135 Module* module_singleton = Module::Get(); |
136 if (!module_singleton) | 136 if (!module_singleton) |
137 return; | 137 return; |
138 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); | 138 Instance* instance = module_singleton->InstanceForPPInstance(pp_instance); |
139 if (!instance) | 139 if (!instance) |
140 return; | 140 return; |
141 instance->HandleMessage(Var(Var::PassRef(), var)); | 141 instance->HandleMessage(Var(PASS_REF, var)); |
142 } | 142 } |
143 | 143 |
144 static PPP_Messaging instance_messaging_interface = { | 144 static PPP_Messaging instance_messaging_interface = { |
145 &Messaging_HandleMessage | 145 &Messaging_HandleMessage |
146 }; | 146 }; |
147 | 147 |
148 // Module ---------------------------------------------------------------------- | 148 // Module ---------------------------------------------------------------------- |
149 | 149 |
150 Module::Module() : pp_module_(0), get_browser_interface_(NULL), core_(NULL) { | 150 Module::Module() : pp_module_(0), get_browser_interface_(NULL), core_(NULL) { |
151 } | 151 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( | 210 const PPB_Core* core = reinterpret_cast<const PPB_Core*>(GetBrowserInterface( |
211 PPB_CORE_INTERFACE)); | 211 PPB_CORE_INTERFACE)); |
212 if (!core) | 212 if (!core) |
213 return false; | 213 return false; |
214 core_ = new Core(core); | 214 core_ = new Core(core); |
215 | 215 |
216 return Init(); | 216 return Init(); |
217 } | 217 } |
218 | 218 |
219 } // namespace pp | 219 } // namespace pp |
OLD | NEW |