OLD | NEW |
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/glue/plugins/pepper_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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "ppapi/c/pp_var.h" | 42 #include "ppapi/c/pp_var.h" |
43 #include "ppapi/c/ppb_core.h" | 43 #include "ppapi/c/ppb_core.h" |
44 #include "ppapi/c/ppb_graphics_2d.h" | 44 #include "ppapi/c/ppb_graphics_2d.h" |
45 #include "ppapi/c/ppb_image_data.h" | 45 #include "ppapi/c/ppb_image_data.h" |
46 #include "ppapi/c/ppb_instance.h" | 46 #include "ppapi/c/ppb_instance.h" |
47 #include "ppapi/c/ppb_var.h" | 47 #include "ppapi/c/ppb_var.h" |
48 #include "ppapi/c/ppp.h" | 48 #include "ppapi/c/ppp.h" |
49 #include "ppapi/c/ppp_instance.h" | 49 #include "ppapi/c/ppp_instance.h" |
50 #include "webkit/glue/plugins/pepper_audio.h" | 50 #include "webkit/glue/plugins/pepper_audio.h" |
51 #include "webkit/glue/plugins/pepper_buffer.h" | 51 #include "webkit/glue/plugins/pepper_buffer.h" |
| 52 #include "webkit/glue/plugins/pepper_common.h" |
52 #include "webkit/glue/plugins/pepper_char_set.h" | 53 #include "webkit/glue/plugins/pepper_char_set.h" |
53 #include "webkit/glue/plugins/pepper_cursor_control.h" | 54 #include "webkit/glue/plugins/pepper_cursor_control.h" |
54 #include "webkit/glue/plugins/pepper_directory_reader.h" | 55 #include "webkit/glue/plugins/pepper_directory_reader.h" |
55 #include "webkit/glue/plugins/pepper_file_chooser.h" | 56 #include "webkit/glue/plugins/pepper_file_chooser.h" |
56 #include "webkit/glue/plugins/pepper_file_io.h" | 57 #include "webkit/glue/plugins/pepper_file_io.h" |
57 #include "webkit/glue/plugins/pepper_file_ref.h" | 58 #include "webkit/glue/plugins/pepper_file_ref.h" |
58 #include "webkit/glue/plugins/pepper_file_system.h" | 59 #include "webkit/glue/plugins/pepper_file_system.h" |
59 #include "webkit/glue/plugins/pepper_font.h" | 60 #include "webkit/glue/plugins/pepper_font.h" |
60 #include "webkit/glue/plugins/pepper_graphics_2d.h" | 61 #include "webkit/glue/plugins/pepper_graphics_2d.h" |
61 #include "webkit/glue/plugins/pepper_image_data.h" | 62 #include "webkit/glue/plugins/pepper_image_data.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 135 |
135 void CallOnMainThread(int delay_in_msec, | 136 void CallOnMainThread(int delay_in_msec, |
136 PP_CompletionCallback callback, | 137 PP_CompletionCallback callback, |
137 int32_t result) { | 138 int32_t result) { |
138 GetMainThreadMessageLoop()->PostDelayedTask( | 139 GetMainThreadMessageLoop()->PostDelayedTask( |
139 FROM_HERE, | 140 FROM_HERE, |
140 NewRunnableFunction(callback.func, callback.user_data, result), | 141 NewRunnableFunction(callback.func, callback.user_data, result), |
141 delay_in_msec); | 142 delay_in_msec); |
142 } | 143 } |
143 | 144 |
144 bool IsMainThread() { | 145 PP_Bool IsMainThread() { |
145 return GetMainThreadMessageLoop()->BelongsToCurrentThread(); | 146 return BoolToPPBool(GetMainThreadMessageLoop()->BelongsToCurrentThread()); |
146 } | 147 } |
147 | 148 |
148 const PPB_Core core_interface = { | 149 const PPB_Core core_interface = { |
149 &AddRefResource, | 150 &AddRefResource, |
150 &ReleaseResource, | 151 &ReleaseResource, |
151 &MemAlloc, | 152 &MemAlloc, |
152 &MemFree, | 153 &MemFree, |
153 &GetTime, | 154 &GetTime, |
154 &GetTickTime, | 155 &GetTickTime, |
155 &CallOnMainThread, | 156 &CallOnMainThread, |
156 &IsMainThread | 157 &IsMainThread |
157 }; | 158 }; |
158 | 159 |
159 // PPB_Testing ----------------------------------------------------------------- | 160 // PPB_Testing ----------------------------------------------------------------- |
160 | 161 |
161 bool ReadImageData(PP_Resource device_context_2d, | 162 PP_Bool ReadImageData(PP_Resource device_context_2d, |
162 PP_Resource image, | 163 PP_Resource image, |
163 const PP_Point* top_left) { | 164 const PP_Point* top_left) { |
164 scoped_refptr<Graphics2D> context( | 165 scoped_refptr<Graphics2D> context( |
165 Resource::GetAs<Graphics2D>(device_context_2d)); | 166 Resource::GetAs<Graphics2D>(device_context_2d)); |
166 if (!context.get()) | 167 if (!context.get()) |
167 return false; | 168 return PP_FALSE; |
168 return context->ReadImageData(image, top_left); | 169 return BoolToPPBool(context->ReadImageData(image, top_left)); |
169 } | 170 } |
170 | 171 |
171 void RunMessageLoop() { | 172 void RunMessageLoop() { |
172 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 173 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
173 MessageLoop::current()->SetNestableTasksAllowed(true); | 174 MessageLoop::current()->SetNestableTasksAllowed(true); |
174 MessageLoop::current()->Run(); | 175 MessageLoop::current()->Run(); |
175 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 176 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
176 } | 177 } |
177 | 178 |
178 void QuitMessageLoop() { | 179 void QuitMessageLoop() { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 live_plugin_objects_.insert(plugin_object); | 480 live_plugin_objects_.insert(plugin_object); |
480 } | 481 } |
481 | 482 |
482 void PluginModule::RemovePluginObject(PluginObject* plugin_object) { | 483 void PluginModule::RemovePluginObject(PluginObject* plugin_object) { |
483 // Don't actually verify that the object is in the set since during module | 484 // Don't actually verify that the object is in the set since during module |
484 // deletion we'll be in the process of freeing them. | 485 // deletion we'll be in the process of freeing them. |
485 live_plugin_objects_.erase(plugin_object); | 486 live_plugin_objects_.erase(plugin_object); |
486 } | 487 } |
487 | 488 |
488 } // namespace pepper | 489 } // namespace pepper |
OLD | NEW |