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 "webkit/plugins/ppapi/ppb_flash_message_loop_impl.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 callback.Run(PP_ERROR_FAILED); | 81 callback.Run(PP_ERROR_FAILED); |
82 return PP_ERROR_FAILED; | 82 return PP_ERROR_FAILED; |
83 } | 83 } |
84 state_->set_run_called(); | 84 state_->set_run_called(); |
85 state_->set_run_callback(callback); | 85 state_->set_run_callback(callback); |
86 | 86 |
87 // It is possible that the PPB_Flash_MessageLoop_Impl object has been | 87 // It is possible that the PPB_Flash_MessageLoop_Impl object has been |
88 // destroyed when the nested message loop exits. | 88 // destroyed when the nested message loop exits. |
89 scoped_refptr<State> state_protector(state_); | 89 scoped_refptr<State> state_protector(state_); |
90 | 90 |
91 bool old_value = MessageLoop::current()->NestableTasksAllowed(); | 91 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
92 MessageLoop::current()->SetNestableTasksAllowed(true); | |
93 MessageLoop::current()->Run(); | 92 MessageLoop::current()->Run(); |
94 | 93 |
95 // Don't access data members of the class below. | 94 // Don't access data members of the class below. |
96 | 95 |
97 MessageLoop::current()->SetNestableTasksAllowed(old_value); | |
98 return state_protector->result(); | 96 return state_protector->result(); |
Ryan Sleevi
2012/02/11 02:17:22
Also here - state_protector->result() runs while n
jar (doing other things)
2012/02/11 03:24:38
+1
Please put lines 91 and 92 into a local scope.
dhollowa
2012/02/13 17:44:26
Done.
| |
99 } | 97 } |
100 | 98 |
101 void PPB_Flash_MessageLoop_Impl::InternalQuit(int32_t result) { | 99 void PPB_Flash_MessageLoop_Impl::InternalQuit(int32_t result) { |
102 if (!state_->run_called() || state_->quit_called()) | 100 if (!state_->run_called() || state_->quit_called()) |
103 return; | 101 return; |
104 state_->set_quit_called(); | 102 state_->set_quit_called(); |
105 state_->set_result(result); | 103 state_->set_result(result); |
106 | 104 |
107 MessageLoop::current()->QuitNow(); | 105 MessageLoop::current()->QuitNow(); |
108 | 106 |
109 if (!state_->run_callback().is_null()) | 107 if (!state_->run_callback().is_null()) |
110 state_->run_callback().Run(result); | 108 state_->run_callback().Run(result); |
111 } | 109 } |
112 | 110 |
113 } // namespace ppapi | 111 } // namespace ppapi |
114 } // namespace webkit | 112 } // namespace webkit |
OLD | NEW |