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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 void CallOnMainThread(int delay_in_msec, | 114 void CallOnMainThread(int delay_in_msec, |
115 PP_CompletionCallback callback, | 115 PP_CompletionCallback callback, |
116 int32_t result) { | 116 int32_t result) { |
117 GetMainThreadMessageLoop()->PostDelayedTask( | 117 GetMainThreadMessageLoop()->PostDelayedTask( |
118 FROM_HERE, | 118 FROM_HERE, |
119 NewRunnableFunction(callback.func, callback.user_data, result), | 119 NewRunnableFunction(callback.func, callback.user_data, result), |
120 delay_in_msec); | 120 delay_in_msec); |
121 } | 121 } |
122 | 122 |
| 123 bool IsMainThread() { |
| 124 return GetMainThreadMessageLoop()->BelongsToCurrentThread(); |
| 125 } |
| 126 |
123 const PPB_Core core_interface = { | 127 const PPB_Core core_interface = { |
124 &AddRefResource, | 128 &AddRefResource, |
125 &ReleaseResource, | 129 &ReleaseResource, |
126 &MemAlloc, | 130 &MemAlloc, |
127 &MemFree, | 131 &MemFree, |
128 &GetTime, | 132 &GetTime, |
129 &CallOnMainThread | 133 &CallOnMainThread, |
| 134 &IsMainThread |
130 }; | 135 }; |
131 | 136 |
132 // PPB_Testing ----------------------------------------------------------------- | 137 // PPB_Testing ----------------------------------------------------------------- |
133 | 138 |
134 bool ReadImageData(PP_Resource device_context_2d, | 139 bool ReadImageData(PP_Resource device_context_2d, |
135 PP_Resource image, | 140 PP_Resource image, |
136 const PP_Point* top_left) { | 141 const PP_Point* top_left) { |
137 scoped_refptr<DeviceContext2D> context( | 142 scoped_refptr<DeviceContext2D> context( |
138 Resource::GetAs<DeviceContext2D>(device_context_2d)); | 143 Resource::GetAs<DeviceContext2D>(device_context_2d)); |
139 if (!context.get()) | 144 if (!context.get()) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 391 |
387 void PluginModule::InstanceCreated(PluginInstance* instance) { | 392 void PluginModule::InstanceCreated(PluginInstance* instance) { |
388 instances_.insert(instance); | 393 instances_.insert(instance); |
389 } | 394 } |
390 | 395 |
391 void PluginModule::InstanceDeleted(PluginInstance* instance) { | 396 void PluginModule::InstanceDeleted(PluginInstance* instance) { |
392 instances_.erase(instance); | 397 instances_.erase(instance); |
393 } | 398 } |
394 | 399 |
395 } // namespace pepper | 400 } // namespace pepper |
OLD | NEW |