Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: ppapi/proxy/ppb_testing_proxy.cc

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_testing_proxy.h" 5 #include "ppapi/proxy/ppb_testing_proxy.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "ppapi/c/dev/ppb_testing_dev.h" 8 #include "ppapi/c/dev/ppb_testing_dev.h"
9 #include "ppapi/proxy/enter_proxy.h" 9 #include "ppapi/proxy/enter_proxy.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return PP_FALSE; 43 return PP_FALSE;
44 44
45 PP_Bool result = PP_FALSE; 45 PP_Bool result = PP_FALSE;
46 dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData( 46 dispatcher->Send(new PpapiHostMsg_PPBTesting_ReadImageData(
47 API_ID_PPB_TESTING, graphics_2d_object->host_resource(), 47 API_ID_PPB_TESTING, graphics_2d_object->host_resource(),
48 image_object->host_resource(), *top_left, &result)); 48 image_object->host_resource(), *top_left, &result));
49 return result; 49 return result;
50 } 50 }
51 51
52 void RunMessageLoop(PP_Instance instance) { 52 void RunMessageLoop(PP_Instance instance) {
53 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 53 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
54 MessageLoop::current()->SetNestableTasksAllowed(true);
55 MessageLoop::current()->Run(); 54 MessageLoop::current()->Run();
56 MessageLoop::current()->SetNestableTasksAllowed(old_state);
57 } 55 }
58 56
59 void QuitMessageLoop(PP_Instance instance) { 57 void QuitMessageLoop(PP_Instance instance) {
60 MessageLoop::current()->QuitNow(); 58 MessageLoop::current()->QuitNow();
61 } 59 }
62 60
63 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { 61 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
64 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); 62 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
65 if (!dispatcher) 63 if (!dispatcher)
66 return static_cast<uint32_t>(-1); 64 return static_cast<uint32_t>(-1);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 scoped_refptr<PPB_InputEvent_Shared> input_event_impl( 189 scoped_refptr<PPB_InputEvent_Shared> input_event_impl(
192 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(), 190 new PPB_InputEvent_Shared(PPB_InputEvent_Shared::InitAsProxy(),
193 instance, 191 instance,
194 input_event)); 192 input_event));
195 ppb_testing_impl_->SimulateInputEvent(instance, 193 ppb_testing_impl_->SimulateInputEvent(instance,
196 input_event_impl->pp_resource()); 194 input_event_impl->pp_resource());
197 } 195 }
198 196
199 } // namespace proxy 197 } // namespace proxy
200 } // namespace ppapi 198 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698