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

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/plugin_object.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/plugins/pepper_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/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "ppapi/c/dev/ppb_buffer_dev.h" 15 #include "ppapi/c/dev/ppb_buffer_dev.h"
(...skipping 25 matching lines...) Expand all
41 #include "ppapi/c/ppb_image_data.h" 41 #include "ppapi/c/ppb_image_data.h"
42 #include "ppapi/c/ppb_instance.h" 42 #include "ppapi/c/ppb_instance.h"
43 #include "ppapi/c/ppb_url_loader.h" 43 #include "ppapi/c/ppb_url_loader.h"
44 #include "ppapi/c/ppb_url_request_info.h" 44 #include "ppapi/c/ppb_url_request_info.h"
45 #include "ppapi/c/ppb_url_response_info.h" 45 #include "ppapi/c/ppb_url_response_info.h"
46 #include "ppapi/c/ppb_var.h" 46 #include "ppapi/c/ppb_var.h"
47 #include "ppapi/c/ppp.h" 47 #include "ppapi/c/ppp.h"
48 #include "ppapi/c/ppp_instance.h" 48 #include "ppapi/c/ppp_instance.h"
49 #include "ppapi/c/trusted/ppb_image_data_trusted.h" 49 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
50 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" 50 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
51 #include "webkit/glue/plugins/pepper_audio.h" 51 #include "webkit/plugins/ppapi/common.h"
52 #include "webkit/glue/plugins/pepper_buffer.h" 52 #include "webkit/plugins/ppapi/plugin_instance.h"
53 #include "webkit/glue/plugins/pepper_common.h" 53 #include "webkit/plugins/ppapi/plugin_object.h"
54 #include "webkit/glue/plugins/pepper_char_set.h" 54 #include "webkit/plugins/ppapi/ppb_audio_impl.h"
55 #include "webkit/glue/plugins/pepper_class.h" 55 #include "webkit/plugins/ppapi/ppb_buffer_impl.h"
56 #include "webkit/glue/plugins/pepper_cursor_control.h" 56 #include "webkit/plugins/ppapi/ppb_char_set_impl.h"
57 #include "webkit/glue/plugins/pepper_directory_reader.h" 57 #include "webkit/plugins/ppapi/ppb_cursor_control_impl.h"
58 #include "webkit/glue/plugins/pepper_file_chooser.h" 58 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
59 #include "webkit/glue/plugins/pepper_file_io.h" 59 #include "webkit/plugins/ppapi/ppb_file_chooser_impl.h"
60 #include "webkit/glue/plugins/pepper_file_ref.h" 60 #include "webkit/plugins/ppapi/ppb_file_io_impl.h"
61 #include "webkit/glue/plugins/pepper_file_system.h" 61 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
62 #include "webkit/glue/plugins/pepper_font.h" 62 #include "webkit/plugins/ppapi/ppb_file_system_impl.h"
63 #include "webkit/glue/plugins/pepper_graphics_2d.h" 63 #include "webkit/plugins/ppapi/ppb_flash.h"
64 #include "webkit/glue/plugins/pepper_image_data.h" 64 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
65 #include "webkit/glue/plugins/pepper_plugin_instance.h" 65 #include "webkit/plugins/ppapi/ppb_font_impl.h"
66 #include "webkit/glue/plugins/pepper_plugin_object.h" 66 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
67 #include "webkit/glue/plugins/pepper_private.h" 67 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
68 #include "webkit/glue/plugins/pepper_private2.h" 68 #include "webkit/plugins/ppapi/ppb_pdf.h"
69 #include "webkit/glue/plugins/pepper_resource_tracker.h" 69 #include "webkit/plugins/ppapi/ppb_pdf_impl.h"
70 #include "webkit/glue/plugins/pepper_scrollbar.h" 70 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h"
71 #include "webkit/glue/plugins/pepper_transport.h" 71 #include "webkit/plugins/ppapi/ppb_transport_impl.h"
72 #include "webkit/glue/plugins/pepper_url_loader.h" 72 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
73 #include "webkit/glue/plugins/pepper_url_request_info.h" 73 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
74 #include "webkit/glue/plugins/pepper_url_response_info.h" 74 #include "webkit/plugins/ppapi/ppb_url_response_info_impl.h"
75 #include "webkit/glue/plugins/pepper_url_util.h" 75 #include "webkit/plugins/ppapi/ppb_url_util_impl.h"
76 #include "webkit/glue/plugins/pepper_var.h" 76 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
77 #include "webkit/glue/plugins/pepper_video_decoder.h" 77 #include "webkit/plugins/ppapi/ppb_widget_impl.h"
78 #include "webkit/glue/plugins/pepper_widget.h" 78 #include "webkit/plugins/ppapi/resource_tracker.h"
79 #include "webkit/glue/plugins/ppb_private.h" 79 #include "webkit/plugins/ppapi/var.h"
80 #include "webkit/glue/plugins/ppb_private2.h" 80 #include "webkit/plugins/ppapi/var_object_class.h"
81 81
82 #ifdef ENABLE_GPU 82 #ifdef ENABLE_GPU
83 #include "webkit/glue/plugins/pepper_graphics_3d.h" 83 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
84 #endif // ENABLE_GPU 84 #endif // ENABLE_GPU
85 85
86 namespace pepper { 86 namespace webkit {
87 namespace ppapi {
87 88
88 namespace { 89 namespace {
89 90
90 // Maintains all currently loaded plugin libs for validating PP_Module 91 // Maintains all currently loaded plugin libs for validating PP_Module
91 // identifiers. 92 // identifiers.
92 typedef std::set<PluginModule*> PluginModuleSet; 93 typedef std::set<PluginModule*> PluginModuleSet;
93 94
94 PluginModuleSet* GetLivePluginSet() { 95 PluginModuleSet* GetLivePluginSet() {
95 static PluginModuleSet live_plugin_libs; 96 static PluginModuleSet live_plugin_libs;
96 return &live_plugin_libs; 97 return &live_plugin_libs;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 &MemFree, 156 &MemFree,
156 &GetTime, 157 &GetTime,
157 &GetTickTime, 158 &GetTickTime,
158 &CallOnMainThread, 159 &CallOnMainThread,
159 &IsMainThread 160 &IsMainThread
160 }; 161 };
161 162
162 // PPB_Testing ----------------------------------------------------------------- 163 // PPB_Testing -----------------------------------------------------------------
163 164
164 PP_Bool ReadImageData(PP_Resource device_context_2d, 165 PP_Bool ReadImageData(PP_Resource device_context_2d,
165 PP_Resource image, 166 PP_Resource image,
166 const PP_Point* top_left) { 167 const PP_Point* top_left) {
167 scoped_refptr<Graphics2D> context( 168 scoped_refptr<PPB_Graphics2D_Impl> context(
168 Resource::GetAs<Graphics2D>(device_context_2d)); 169 Resource::GetAs<PPB_Graphics2D_Impl>(device_context_2d));
169 if (!context.get()) 170 if (!context.get())
170 return PP_FALSE; 171 return PP_FALSE;
171 return BoolToPPBool(context->ReadImageData(image, top_left)); 172 return BoolToPPBool(context->ReadImageData(image, top_left));
172 } 173 }
173 174
174 void RunMessageLoop() { 175 void RunMessageLoop() {
175 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 176 bool old_state = MessageLoop::current()->NestableTasksAllowed();
176 MessageLoop::current()->SetNestableTasksAllowed(true); 177 MessageLoop::current()->SetNestableTasksAllowed(true);
177 MessageLoop::current()->Run(); 178 MessageLoop::current()->Run();
178 MessageLoop::current()->SetNestableTasksAllowed(old_state); 179 MessageLoop::current()->SetNestableTasksAllowed(old_state);
(...skipping 13 matching lines...) Expand all
192 const PPB_Testing_Dev testing_interface = { 193 const PPB_Testing_Dev testing_interface = {
193 &ReadImageData, 194 &ReadImageData,
194 &RunMessageLoop, 195 &RunMessageLoop,
195 &QuitMessageLoop, 196 &QuitMessageLoop,
196 &GetLiveObjectCount 197 &GetLiveObjectCount
197 }; 198 };
198 199
199 // GetInterface ---------------------------------------------------------------- 200 // GetInterface ----------------------------------------------------------------
200 201
201 const void* GetInterface(const char* name) { 202 const void* GetInterface(const char* name) {
203 // Please keep alphabetized by interface macro name with "special" stuff at
204 // the bottom.
205 if (strcmp(name, PPB_AUDIO_CONFIG_DEV_INTERFACE) == 0)
206 return PPB_AudioConfig_Impl::GetInterface();
207 if (strcmp(name, PPB_AUDIO_DEV_INTERFACE) == 0)
208 return PPB_Audio_Impl::GetInterface();
209 if (strcmp(name, PPB_AUDIO_TRUSTED_DEV_INTERFACE) == 0)
210 return PPB_Audio_Impl::GetTrustedInterface();
211 if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0)
212 return PPB_Buffer_Impl::GetInterface();
213 if (strcmp(name, PPB_CHAR_SET_DEV_INTERFACE) == 0)
214 return PPB_CharSet_Impl::GetInterface();
215 if (strcmp(name, PPB_CLASS_INTERFACE) == 0)
216 return VarObjectClass::GetInterface();
202 if (strcmp(name, PPB_CORE_INTERFACE) == 0) 217 if (strcmp(name, PPB_CORE_INTERFACE) == 0)
203 return &core_interface; 218 return &core_interface;
219 if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0)
220 return GetCursorControlInterface();
221 if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0)
222 return PPB_DirectoryReader_Impl::GetInterface();
223 if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0)
224 return PPB_FileChooser_Impl::GetInterface();
225 if (strcmp(name, PPB_FILEIO_DEV_INTERFACE) == 0)
226 return PPB_FileIO_Impl::GetInterface();
227 if (strcmp(name, PPB_FILEIOTRUSTED_DEV_INTERFACE) == 0)
228 return PPB_FileIO_Impl::GetTrustedInterface();
229 if (strcmp(name, PPB_FILEREF_DEV_INTERFACE) == 0)
230 return PPB_FileRef_Impl::GetInterface();
231 if (strcmp(name, PPB_FILESYSTEM_DEV_INTERFACE) == 0)
232 return PPB_FileSystem_Impl::GetInterface();
233 if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0)
234 return PluginInstance::GetFindInterface();
235 if (strcmp(name, PPB_FLASH_INTERFACE) == 0)
236 return PPB_Flash_Impl::GetInterface();
237 if (strcmp(name, PPB_FONT_DEV_INTERFACE) == 0)
238 return PPB_Font_Impl::GetInterface();
239 if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0)
240 return PluginInstance::GetFullscreenInterface();
241 if (strcmp(name, PPB_GRAPHICS_2D_INTERFACE) == 0)
242 return PPB_Graphics2D_Impl::GetInterface();
243 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0)
244 return PPB_ImageData_Impl::GetInterface();
245 if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE) == 0)
246 return PPB_ImageData_Impl::GetTrustedInterface();
247 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0)
248 return PluginInstance::GetInterface();
249 if (strcmp(name, PPB_PDF_INTERFACE) == 0)
250 return PPB_PDF_Impl::GetInterface();
251 if (strcmp(name, PPB_SCROLLBAR_DEV_INTERFACE) == 0)
252 return PPB_Scrollbar_Impl::GetInterface();
253 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
254 return PPB_Transport_Impl::GetInterface();
255 if (strcmp(name, PPB_URLLOADER_INTERFACE) == 0)
256 return PPB_URLLoader_Impl::GetInterface();
257 if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0)
258 return PPB_URLLoader_Impl::GetTrustedInterface();
259 if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE) == 0)
260 return PPB_URLRequestInfo_Impl::GetInterface();
261 if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE) == 0)
262 return PPB_URLResponseInfo_Impl::GetInterface();
263 if (strcmp(name, PPB_URLUTIL_DEV_INTERFACE) == 0)
264 return PPB_UrlUtil_Impl::GetInterface();
204 if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0) 265 if (strcmp(name, PPB_VAR_DEPRECATED_INTERFACE) == 0)
205 return Var::GetDeprecatedInterface(); 266 return Var::GetDeprecatedInterface();
206 if (strcmp(name, PPB_VAR_INTERFACE) == 0) 267 if (strcmp(name, PPB_VAR_INTERFACE) == 0)
207 return Var::GetInterface(); 268 return Var::GetInterface();
208 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0) 269 if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0)
209 return PluginInstance::GetInterface(); 270 return PPB_VideoDecoder_Impl::GetInterface();
210 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) 271 if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
211 return ImageData::GetInterface(); 272 return PPB_Widget_Impl::GetInterface();
212 if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE) == 0) 273 if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
213 return ImageData::GetTrustedInterface(); 274 return PluginInstance::GetZoomInterface();
214 if (strcmp(name, PPB_AUDIO_CONFIG_DEV_INTERFACE) == 0) 275
215 return AudioConfig::GetInterface();
216 if (strcmp(name, PPB_AUDIO_DEV_INTERFACE) == 0)
217 return Audio::GetInterface();
218 if (strcmp(name, PPB_AUDIO_TRUSTED_DEV_INTERFACE) == 0)
219 return Audio::GetTrustedInterface();
220 if (strcmp(name, PPB_GRAPHICS_2D_INTERFACE) == 0)
221 return Graphics2D::GetInterface();
222 #ifdef ENABLE_GPU 276 #ifdef ENABLE_GPU
223 if (strcmp(name, PPB_GRAPHICS_3D_DEV_INTERFACE) == 0) 277 if (strcmp(name, PPB_GRAPHICS_3D_DEV_INTERFACE) == 0)
224 return Graphics3D::GetInterface(); 278 return PPB_Graphics3D_Impl::GetInterface();
225 if (strcmp(name, PPB_OPENGLES_DEV_INTERFACE) == 0) 279 if (strcmp(name, PPB_OPENGLES_DEV_INTERFACE) == 0)
226 return Graphics3D::GetOpenGLESInterface(); 280 return PPB_Graphics3D_Impl::GetOpenGLESInterface();
227 #endif // ENABLE_GPU 281 #endif // ENABLE_GPU
228 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
229 return Transport::GetInterface();
230 if (strcmp(name, PPB_URLLOADER_INTERFACE) == 0)
231 return URLLoader::GetInterface();
232 if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0)
233 return URLLoader::GetTrustedInterface();
234 if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE) == 0)
235 return URLRequestInfo::GetInterface();
236 if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE) == 0)
237 return URLResponseInfo::GetInterface();
238 if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0)
239 return Buffer::GetInterface();
240 if (strcmp(name, PPB_FILEREF_DEV_INTERFACE) == 0)
241 return FileRef::GetInterface();
242 if (strcmp(name, PPB_FILEIO_DEV_INTERFACE) == 0)
243 return FileIO::GetInterface();
244 if (strcmp(name, PPB_FILEIOTRUSTED_DEV_INTERFACE) == 0)
245 return FileIO::GetTrustedInterface();
246 if (strcmp(name, PPB_FILESYSTEM_DEV_INTERFACE) == 0)
247 return FileSystem::GetInterface();
248 if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0)
249 return DirectoryReader::GetInterface();
250 if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
251 return Widget::GetInterface();
252 if (strcmp(name, PPB_SCROLLBAR_DEV_INTERFACE) == 0)
253 return Scrollbar::GetInterface();
254 if (strcmp(name, PPB_FONT_DEV_INTERFACE) == 0)
255 return Font::GetInterface();
256 if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0)
257 return PluginInstance::GetFindInterface();
258 if (strcmp(name, PPB_FULLSCREEN_DEV_INTERFACE) == 0)
259 return PluginInstance::GetFullscreenInterface();
260 if (strcmp(name, PPB_URLUTIL_DEV_INTERFACE) == 0)
261 return UrlUtil::GetInterface();
262 if (strcmp(name, PPB_PRIVATE_INTERFACE) == 0)
263 return Private::GetInterface();
264 if (strcmp(name, PPB_PRIVATE2_INTERFACE) == 0)
265 return Private2::GetInterface();
266 if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0)
267 return FileChooser::GetInterface();
268 if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0)
269 return VideoDecoder::GetInterface();
270 if (strcmp(name, PPB_CHAR_SET_DEV_INTERFACE) == 0)
271 return CharSet::GetInterface();
272 if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0)
273 return GetCursorControlInterface();
274 if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
275 return PluginInstance::GetZoomInterface();
276 if (strcmp(name, PPB_CLASS_INTERFACE) == 0)
277 return VarObjectClass::GetInterface();
278 282
279 // Only support the testing interface when the command line switch is 283 // Only support the testing interface when the command line switch is
280 // specified. This allows us to prevent people from (ab)using this interface 284 // specified. This allows us to prevent people from (ab)using this interface
281 // in production code. 285 // in production code.
282 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) { 286 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) {
283 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) 287 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing"))
284 return &testing_interface; 288 return &testing_interface;
285 } 289 }
286 return NULL; 290 return NULL;
287 } 291 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 bool PluginModule::InitializeModule() { 486 bool PluginModule::InitializeModule() {
483 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules."; 487 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules.";
484 int retval = entry_points_.initialize_module(pp_module(), &GetInterface); 488 int retval = entry_points_.initialize_module(pp_module(), &GetInterface);
485 if (retval != 0) { 489 if (retval != 0) {
486 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 490 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
487 return false; 491 return false;
488 } 492 }
489 return true; 493 return true;
490 } 494 }
491 495
492 } // namespace pepper 496 } // namespace ppapi
497 } // namespace webkit
498
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | webkit/plugins/ppapi/plugin_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698