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