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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 NULL | 141 NULL |
142 }; | 142 }; |
143 scriptable_object_ = g_npnetscape_funcs->createobject(instance_, | 143 scriptable_object_ = g_npnetscape_funcs->createobject(instance_, |
144 &npc_ref_object); | 144 &npc_ref_object); |
145 } | 145 } |
146 return scriptable_object_; | 146 return scriptable_object_; |
147 } | 147 } |
148 | 148 |
149 // PluginMessageLoopProxy::Delegate implementation. | 149 // PluginMessageLoopProxy::Delegate implementation. |
150 virtual bool RunOnPluginThread( | 150 virtual bool RunOnPluginThread( |
151 int delay_ms, void(function)(void*), void* data) OVERRIDE { | 151 base::TimeDelta delay, void(function)(void*), void* data) OVERRIDE { |
152 if (delay_ms == 0) { | 152 if (delay == base::TimeDelta()) { |
153 g_npnetscape_funcs->pluginthreadasynccall(instance_, function, data); | 153 g_npnetscape_funcs->pluginthreadasynccall(instance_, function, data); |
154 } else { | 154 } else { |
155 base::AutoLock auto_lock(timers_lock_); | 155 base::AutoLock auto_lock(timers_lock_); |
156 uint32_t timer_id = g_npnetscape_funcs->scheduletimer( | 156 uint32_t timer_id = g_npnetscape_funcs->scheduletimer( |
157 instance_, delay_ms, false, &NPDelayedTaskSpringboard); | 157 instance_, delay.InMilliseconds(), false, &NPDelayedTaskSpringboard); |
158 DelayedTask task = {function, data}; | 158 DelayedTask task = {function, data}; |
159 timers_[timer_id] = task; | 159 timers_[timer_id] = task; |
160 } | 160 } |
161 return true; | 161 return true; |
162 } | 162 } |
163 | 163 |
164 static void NPDelayedTaskSpringboard(NPP npp, uint32_t timer_id) { | 164 static void NPDelayedTaskSpringboard(NPP npp, uint32_t timer_id) { |
165 HostNPPlugin* self = reinterpret_cast<HostNPPlugin*>(npp->pdata); | 165 HostNPPlugin* self = reinterpret_cast<HostNPPlugin*>(npp->pdata); |
166 DelayedTask task; | 166 DelayedTask task; |
167 { | 167 { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 } | 497 } |
498 | 498 |
499 EXPORT NPError API_CALL NP_GetValue(void* npp, | 499 EXPORT NPError API_CALL NP_GetValue(void* npp, |
500 NPPVariable variable, | 500 NPPVariable variable, |
501 void* value) { | 501 void* value) { |
502 return GetValue((NPP)npp, variable, value); | 502 return GetValue((NPP)npp, variable, value); |
503 } | 503 } |
504 #endif | 504 #endif |
505 | 505 |
506 } // extern "C" | 506 } // extern "C" |
OLD | NEW |