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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 184 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
185 MessageLoop::current()->SetNestableTasksAllowed(true); | 185 MessageLoop::current()->SetNestableTasksAllowed(true); |
186 MessageLoop::current()->Run(); | 186 MessageLoop::current()->Run(); |
187 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 187 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
188 } | 188 } |
189 | 189 |
190 void QuitMessageLoop() { | 190 void QuitMessageLoop() { |
191 MessageLoop::current()->QuitNow(); | 191 MessageLoop::current()->QuitNow(); |
192 } | 192 } |
193 | 193 |
194 uint32_t GetLiveObjectCount(PP_Module module_id) { | 194 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
195 PluginModule* module = ResourceTracker::Get()->GetModule(module_id); | 195 return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id); |
196 if (!module) | |
197 return static_cast<uint32_t>(-1); | |
198 return ResourceTracker::Get()->GetLiveObjectsForModule(module); | |
199 } | 196 } |
200 | 197 |
201 const PPB_Testing_Dev testing_interface = { | 198 const PPB_Testing_Dev testing_interface = { |
202 &ReadImageData, | 199 &ReadImageData, |
203 &RunMessageLoop, | 200 &RunMessageLoop, |
204 &QuitMessageLoop, | 201 &QuitMessageLoop, |
205 &GetLiveObjectCount | 202 &GetLiveObjectsForInstance |
206 }; | 203 }; |
207 | 204 |
208 // GetInterface ---------------------------------------------------------------- | 205 // GetInterface ---------------------------------------------------------------- |
209 | 206 |
210 const void* GetInterface(const char* name) { | 207 const void* GetInterface(const char* name) { |
211 // Please keep alphabetized by interface macro name with "special" stuff at | 208 // Please keep alphabetized by interface macro name with "special" stuff at |
212 // the bottom. | 209 // the bottom. |
213 if (strcmp(name, PPB_AUDIO_CONFIG_INTERFACE) == 0) | 210 if (strcmp(name, PPB_AUDIO_CONFIG_INTERFACE) == 0) |
214 return PPB_AudioConfig_Impl::GetInterface(); | 211 return PPB_AudioConfig_Impl::GetInterface(); |
215 if (strcmp(name, PPB_AUDIO_INTERFACE) == 0) | 212 if (strcmp(name, PPB_AUDIO_INTERFACE) == 0) |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 if (retval != 0) { | 469 if (retval != 0) { |
473 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 470 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
474 return false; | 471 return false; |
475 } | 472 } |
476 return true; | 473 return true; |
477 } | 474 } |
478 | 475 |
479 } // namespace ppapi | 476 } // namespace ppapi |
480 } // namespace webkit | 477 } // namespace webkit |
481 | 478 |
OLD | NEW |