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