| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/proxy/ppb_message_loop_proxy.h" | 5 #include "ppapi/proxy/ppb_message_loop_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include <vector> | 9 #include <vector> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/location.h" | 13 #include "base/location.h" |
| 12 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 13 #include "ppapi/c/pp_errors.h" | 15 #include "ppapi/c/pp_errors.h" |
| 14 #include "ppapi/c/ppb_message_loop.h" | 16 #include "ppapi/c/ppb_message_loop.h" |
| 15 #include "ppapi/proxy/plugin_dispatcher.h" | 17 #include "ppapi/proxy/plugin_dispatcher.h" |
| 16 #include "ppapi/proxy/plugin_globals.h" | 18 #include "ppapi/proxy/plugin_globals.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 PluginGlobals* globals = PluginGlobals::Get(); | 173 PluginGlobals* globals = PluginGlobals::Get(); |
| 172 if (!globals->msg_loop_slot()) | 174 if (!globals->msg_loop_slot()) |
| 173 return false; // Can't be current if there's nothing in the slot. | 175 return false; // Can't be current if there's nothing in the slot. |
| 174 return static_cast<const void*>(globals->msg_loop_slot()->Get()) == | 176 return static_cast<const void*>(globals->msg_loop_slot()->Get()) == |
| 175 static_cast<const void*>(this); | 177 static_cast<const void*>(this); |
| 176 } | 178 } |
| 177 | 179 |
| 178 void MessageLoopResource::PostClosure( | 180 void MessageLoopResource::PostClosure( |
| 179 const tracked_objects::Location& from_here, | 181 const tracked_objects::Location& from_here, |
| 180 const base::Closure& closure, | 182 const base::Closure& closure, |
| 181 int64 delay_ms) { | 183 int64_t delay_ms) { |
| 182 if (task_runner_.get()) { | 184 if (task_runner_.get()) { |
| 183 task_runner_->PostDelayedTask(from_here, closure, | 185 task_runner_->PostDelayedTask(from_here, closure, |
| 184 base::TimeDelta::FromMilliseconds(delay_ms)); | 186 base::TimeDelta::FromMilliseconds(delay_ms)); |
| 185 } else { | 187 } else { |
| 186 TaskInfo info; | 188 TaskInfo info; |
| 187 info.from_here = FROM_HERE; | 189 info.from_here = FROM_HERE; |
| 188 info.closure = closure; | 190 info.closure = closure; |
| 189 info.delay_ms = delay_ms; | 191 info.delay_ms = delay_ms; |
| 190 pending_tasks_.push_back(info); | 192 pending_tasks_.push_back(info); |
| 191 } | 193 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { | 277 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { |
| 276 } | 278 } |
| 277 | 279 |
| 278 // static | 280 // static |
| 279 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { | 281 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { |
| 280 return &ppb_message_loop_interface; | 282 return &ppb_message_loop_interface; |
| 281 } | 283 } |
| 282 | 284 |
| 283 } // namespace proxy | 285 } // namespace proxy |
| 284 } // namespace ppapi | 286 } // namespace ppapi |
| OLD | NEW |