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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 int32_t MessageLoopResource::PostQuit(PP_Bool should_destroy) { | 136 int32_t MessageLoopResource::PostQuit(PP_Bool should_destroy) { |
137 if (is_main_thread_loop_) | 137 if (is_main_thread_loop_) |
138 return PP_ERROR_WRONG_THREAD; | 138 return PP_ERROR_WRONG_THREAD; |
139 | 139 |
140 if (PP_ToBool(should_destroy)) | 140 if (PP_ToBool(should_destroy)) |
141 should_destroy_ = true; | 141 should_destroy_ = true; |
142 | 142 |
143 if (IsCurrent() && nested_invocations_ > 0) | 143 if (IsCurrent() && nested_invocations_ > 0) |
144 loop_->Quit(); | 144 loop_->QuitWhenIdle(); |
145 else | 145 else |
146 PostClosure(FROM_HERE, base::MessageLoop::QuitClosure(), 0); | 146 PostClosure(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 0); |
147 return PP_OK; | 147 return PP_OK; |
148 } | 148 } |
149 | 149 |
150 // static | 150 // static |
151 MessageLoopResource* MessageLoopResource::GetCurrent() { | 151 MessageLoopResource* MessageLoopResource::GetCurrent() { |
152 PluginGlobals* globals = PluginGlobals::Get(); | 152 PluginGlobals* globals = PluginGlobals::Get(); |
153 if (!globals->msg_loop_slot()) | 153 if (!globals->msg_loop_slot()) |
154 return NULL; | 154 return NULL; |
155 return reinterpret_cast<MessageLoopResource*>( | 155 return reinterpret_cast<MessageLoopResource*>( |
156 globals->msg_loop_slot()->Get()); | 156 globals->msg_loop_slot()->Get()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { | 275 PPB_MessageLoop_Proxy::~PPB_MessageLoop_Proxy() { |
276 } | 276 } |
277 | 277 |
278 // static | 278 // static |
279 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { | 279 const PPB_MessageLoop_1_0* PPB_MessageLoop_Proxy::GetInterface() { |
280 return &ppb_message_loop_interface; | 280 return &ppb_message_loop_interface; |
281 } | 281 } |
282 | 282 |
283 } // namespace proxy | 283 } // namespace proxy |
284 } // namespace ppapi | 284 } // namespace ppapi |
OLD | NEW |