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 "content/renderer/pepper/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 "base/run_loop.h" |
9 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
10 #include "third_party/WebKit/public/web/WebView.h" | 11 #include "third_party/WebKit/public/web/WebView.h" |
11 | 12 |
12 using ppapi::thunk::PPB_Flash_MessageLoop_API; | 13 using ppapi::thunk::PPB_Flash_MessageLoop_API; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 class PPB_Flash_MessageLoop_Impl::State | 17 class PPB_Flash_MessageLoop_Impl::State |
17 : public base::RefCounted<PPB_Flash_MessageLoop_Impl::State> { | 18 : public base::RefCounted<PPB_Flash_MessageLoop_Impl::State> { |
18 public: | 19 public: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 state_->set_run_callback(callback); | 84 state_->set_run_callback(callback); |
84 | 85 |
85 // It is possible that the PPB_Flash_MessageLoop_Impl object has been | 86 // It is possible that the PPB_Flash_MessageLoop_Impl object has been |
86 // destroyed when the nested message loop exits. | 87 // destroyed when the nested message loop exits. |
87 scoped_refptr<State> state_protector(state_); | 88 scoped_refptr<State> state_protector(state_); |
88 { | 89 { |
89 base::MessageLoop::ScopedNestableTaskAllower allow( | 90 base::MessageLoop::ScopedNestableTaskAllower allow( |
90 base::MessageLoop::current()); | 91 base::MessageLoop::current()); |
91 blink::WebView::willEnterModalLoop(); | 92 blink::WebView::willEnterModalLoop(); |
92 | 93 |
93 base::MessageLoop::current()->Run(); | 94 base::RunLoop().Run(); |
94 | 95 |
95 blink::WebView::didExitModalLoop(); | 96 blink::WebView::didExitModalLoop(); |
96 } | 97 } |
97 // Don't access data members of the class below. | 98 // Don't access data members of the class below. |
98 | 99 |
99 return state_protector->result(); | 100 return state_protector->result(); |
100 } | 101 } |
101 | 102 |
102 void PPB_Flash_MessageLoop_Impl::InternalQuit(int32_t result) { | 103 void PPB_Flash_MessageLoop_Impl::InternalQuit(int32_t result) { |
103 if (!state_->run_called() || state_->quit_called()) | 104 if (!state_->run_called() || state_->quit_called()) |
104 return; | 105 return; |
105 state_->set_quit_called(); | 106 state_->set_quit_called(); |
106 state_->set_result(result); | 107 state_->set_result(result); |
107 | 108 |
108 base::MessageLoop::current()->QuitNow(); | 109 base::MessageLoop::current()->QuitNow(); |
109 | 110 |
110 if (!state_->run_callback().is_null()) | 111 if (!state_->run_callback().is_null()) |
111 state_->run_callback().Run(result); | 112 state_->run_callback().Run(result); |
112 } | 113 } |
113 | 114 |
114 } // namespace content | 115 } // namespace content |
OLD | NEW |