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 #include "webkit/plugins/ppapi/plugin_module.h" | 5 #include "webkit/plugins/ppapi/plugin_module.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 void QuitMessageLoop(PP_Instance instance) { | 200 void QuitMessageLoop(PP_Instance instance) { |
201 MessageLoop::current()->QuitNow(); | 201 MessageLoop::current()->QuitNow(); |
202 } | 202 } |
203 | 203 |
204 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { | 204 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
205 return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id); | 205 return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id); |
206 } | 206 } |
207 | 207 |
| 208 PP_Bool IsOutOfProcess() { |
| 209 return PP_FALSE; |
| 210 } |
| 211 |
208 const PPB_Testing_Dev testing_interface = { | 212 const PPB_Testing_Dev testing_interface = { |
209 &ReadImageData, | 213 &ReadImageData, |
210 &RunMessageLoop, | 214 &RunMessageLoop, |
211 &QuitMessageLoop, | 215 &QuitMessageLoop, |
212 &GetLiveObjectsForInstance | 216 &GetLiveObjectsForInstance, |
| 217 &IsOutOfProcess |
213 }; | 218 }; |
214 | 219 |
215 // GetInterface ---------------------------------------------------------------- | 220 // GetInterface ---------------------------------------------------------------- |
216 | 221 |
217 const void* GetInterface(const char* name) { | 222 const void* GetInterface(const char* name) { |
218 // All interfaces should be used on the main thread. | 223 // All interfaces should be used on the main thread. |
219 CHECK(IsMainThread()); | 224 CHECK(IsMainThread()); |
220 | 225 |
221 // Allow custom interface factories first stab at the GetInterface call. | 226 // Allow custom interface factories first stab at the GetInterface call. |
222 const void* custom_interface = | 227 const void* custom_interface = |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 #endif // ENABLE_FLAPPER_HACKS | 365 #endif // ENABLE_FLAPPER_HACKS |
361 | 366 |
362 #if defined(ENABLE_P2P_APIS) | 367 #if defined(ENABLE_P2P_APIS) |
363 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) | 368 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) |
364 return ::ppapi::thunk::GetPPB_Transport_Thunk(); | 369 return ::ppapi::thunk::GetPPB_Transport_Thunk(); |
365 #endif | 370 #endif |
366 | 371 |
367 // Only support the testing interface when the command line switch is | 372 // Only support the testing interface when the command line switch is |
368 // specified. This allows us to prevent people from (ab)using this interface | 373 // specified. This allows us to prevent people from (ab)using this interface |
369 // in production code. | 374 // in production code. |
370 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) { | 375 // TODO(dmichael): Remove support for 0.6. Note that 0.7 only adds a function |
| 376 // to the end, so returning an 0.7 struct for use by clients of 0.6 just |
| 377 // works in practice. |
| 378 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0 || |
| 379 strcmp(name, PPB_TESTING_DEV_INTERFACE_0_6) == 0) { |
371 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) | 380 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) |
372 return &testing_interface; | 381 return &testing_interface; |
373 } | 382 } |
374 return NULL; | 383 return NULL; |
375 } | 384 } |
376 | 385 |
377 // Gets the PPAPI entry points from the given library and places them into the | 386 // Gets the PPAPI entry points from the given library and places them into the |
378 // given structure. Returns true on success. | 387 // given structure. Returns true on success. |
379 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, | 388 bool LoadEntryPointsFromLibrary(const base::NativeLibrary& library, |
380 PluginModule::EntryPoints* entry_points) { | 389 PluginModule::EntryPoints* entry_points) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 601 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
593 if (retval != 0) { | 602 if (retval != 0) { |
594 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 603 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
595 return false; | 604 return false; |
596 } | 605 } |
597 return true; | 606 return true; |
598 } | 607 } |
599 | 608 |
600 } // namespace ppapi | 609 } // namespace ppapi |
601 } // namespace webkit | 610 } // namespace webkit |
OLD | NEW |