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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return PP_ERROR_INPROGRESS; | 79 return PP_ERROR_INPROGRESS; |
80 } | 80 } |
81 // TODO(dmichael) check that the current thread can support a message loop. | 81 // TODO(dmichael) check that the current thread can support a message loop. |
82 | 82 |
83 // Take a ref to the MessageLoop on behalf of the TLS. Note that this is an | 83 // Take a ref to the MessageLoop on behalf of the TLS. Note that this is an |
84 // internal ref and not a plugin ref so the plugin can't accidentally | 84 // internal ref and not a plugin ref so the plugin can't accidentally |
85 // release it. This is released by ReleaseMessageLoop(). | 85 // release it. This is released by ReleaseMessageLoop(). |
86 AddRef(); | 86 AddRef(); |
87 slot->Set(this); | 87 slot->Set(this); |
88 | 88 |
89 loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 89 loop_.reset(new base::MessageLoop); |
90 loop_proxy_ = base::MessageLoopProxy::current(); | 90 loop_proxy_ = base::MessageLoopProxy::current(); |
91 | 91 |
92 // Post all pending work to the message loop. | 92 // Post all pending work to the message loop. |
93 for (size_t i = 0; i < pending_tasks_.size(); i++) { | 93 for (size_t i = 0; i < pending_tasks_.size(); i++) { |
94 const TaskInfo& info = pending_tasks_[i]; | 94 const TaskInfo& info = pending_tasks_[i]; |
95 PostClosure(info.from_here, info.closure, info.delay_ms); | 95 PostClosure(info.from_here, info.closure, info.delay_ms); |
96 } | 96 } |
97 pending_tasks_.clear(); | 97 pending_tasks_.clear(); |
98 | 98 |
99 return PP_OK; | 99 return PP_OK; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { | 269 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { |
270 } | 270 } |
271 | 271 |
272 // static | 272 // static |
273 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { | 273 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { |
274 return &ppb_message_loop_interface; | 274 return &ppb_message_loop_interface; |
275 } | 275 } |
276 | 276 |
277 } // namespace proxy | 277 } // namespace proxy |
278 } // namespace ppapi | 278 } // namespace ppapi |
OLD | NEW |