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/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 PP_Bool ReadImageData(PP_Resource device_context_2d, | 176 PP_Bool ReadImageData(PP_Resource device_context_2d, |
177 PP_Resource image, | 177 PP_Resource image, |
178 const PP_Point* top_left) { | 178 const PP_Point* top_left) { |
179 scoped_refptr<PPB_Graphics2D_Impl> context( | 179 scoped_refptr<PPB_Graphics2D_Impl> context( |
180 Resource::GetAs<PPB_Graphics2D_Impl>(device_context_2d)); | 180 Resource::GetAs<PPB_Graphics2D_Impl>(device_context_2d)); |
181 if (!context.get()) | 181 if (!context.get()) |
182 return PP_FALSE; | 182 return PP_FALSE; |
183 return BoolToPPBool(context->ReadImageData(image, top_left)); | 183 return BoolToPPBool(context->ReadImageData(image, top_left)); |
184 } | 184 } |
185 | 185 |
186 void RunMessageLoop() { | 186 void RunMessageLoop(PP_Instance instance) { |
187 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 187 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
188 MessageLoop::current()->SetNestableTasksAllowed(true); | 188 MessageLoop::current()->SetNestableTasksAllowed(true); |
189 MessageLoop::current()->Run(); | 189 MessageLoop::current()->Run(); |
190 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 190 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
191 } | 191 } |
192 | 192 |
193 void QuitMessageLoop() { | 193 void QuitMessageLoop(PP_Instance instance) { |
194 MessageLoop::current()->QuitNow(); | 194 MessageLoop::current()->QuitNow(); |
195 } | 195 } |
196 | 196 |
197 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { | 197 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
198 return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id); | 198 return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id); |
199 } | 199 } |
200 | 200 |
201 const PPB_Testing_Dev testing_interface = { | 201 const PPB_Testing_Dev testing_interface = { |
202 &ReadImageData, | 202 &ReadImageData, |
203 &RunMessageLoop, | 203 &RunMessageLoop, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 if (retval != 0) { | 478 if (retval != 0) { |
479 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 479 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
480 return false; | 480 return false; |
481 } | 481 } |
482 return true; | 482 return true; |
483 } | 483 } |
484 | 484 |
485 } // namespace ppapi | 485 } // namespace ppapi |
486 } // namespace webkit | 486 } // namespace webkit |
487 | 487 |
OLD | NEW |