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 "webkit/plugins/ppapi/ppb_flash_message_loop_impl.h" | 5 #include "content/renderer/pepper/ppb_flash_message_loop_impl.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 | 10 |
11 using ppapi::thunk::PPB_Flash_MessageLoop_API; | 11 using ppapi::thunk::PPB_Flash_MessageLoop_API; |
12 | 12 |
13 namespace webkit { | 13 namespace webkit { |
14 namespace ppapi { | 14 namespace ppapi { |
15 | 15 |
(...skipping 11 matching lines...) Expand all Loading... |
27 | 27 |
28 bool quit_called() const { return quit_called_; } | 28 bool quit_called() const { return quit_called_; } |
29 void set_quit_called() { quit_called_ = true; } | 29 void set_quit_called() { quit_called_ = true; } |
30 | 30 |
31 const RunFromHostProxyCallback& run_callback() const { return run_callback_; } | 31 const RunFromHostProxyCallback& run_callback() const { return run_callback_; } |
32 void set_run_callback(const RunFromHostProxyCallback& run_callback) { | 32 void set_run_callback(const RunFromHostProxyCallback& run_callback) { |
33 run_callback_ = run_callback; | 33 run_callback_ = run_callback; |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
| 37 friend class base::RefCounted<State>; |
| 38 virtual ~State() {} |
| 39 |
37 int32_t result_; | 40 int32_t result_; |
38 bool run_called_; | 41 bool run_called_; |
39 bool quit_called_; | 42 bool quit_called_; |
40 RunFromHostProxyCallback run_callback_; | 43 RunFromHostProxyCallback run_callback_; |
41 }; | 44 }; |
42 | 45 |
43 PPB_Flash_MessageLoop_Impl::PPB_Flash_MessageLoop_Impl(PP_Instance instance) | 46 PPB_Flash_MessageLoop_Impl::PPB_Flash_MessageLoop_Impl(PP_Instance instance) |
44 : Resource(::ppapi::OBJECT_IS_IMPL, instance), | 47 : Resource(::ppapi::OBJECT_IS_IMPL, instance), |
45 state_(new State()) { | 48 state_(new State()) { |
46 } | 49 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 state_->set_result(result); | 107 state_->set_result(result); |
105 | 108 |
106 base::MessageLoop::current()->QuitNow(); | 109 base::MessageLoop::current()->QuitNow(); |
107 | 110 |
108 if (!state_->run_callback().is_null()) | 111 if (!state_->run_callback().is_null()) |
109 state_->run_callback().Run(result); | 112 state_->run_callback().Run(result); |
110 } | 113 } |
111 | 114 |
112 } // namespace ppapi | 115 } // namespace ppapi |
113 } // namespace webkit | 116 } // namespace webkit |
OLD | NEW |