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

Side by Side Diff: content/renderer/devtools_agent.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) 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/devtools_agent.h" 5 #include "content/renderer/devtools_agent.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 20 matching lines...) Expand all
31 namespace { 31 namespace {
32 32
33 class WebKitClientMessageLoopImpl 33 class WebKitClientMessageLoopImpl
34 : public WebDevToolsAgentClient::WebKitClientMessageLoop { 34 : public WebDevToolsAgentClient::WebKitClientMessageLoop {
35 public: 35 public:
36 WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) { } 36 WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) { }
37 virtual ~WebKitClientMessageLoopImpl() { 37 virtual ~WebKitClientMessageLoopImpl() {
38 message_loop_ = NULL; 38 message_loop_ = NULL;
39 } 39 }
40 virtual void run() { 40 virtual void run() {
41 bool old_state = message_loop_->NestableTasksAllowed(); 41 MessageLoop::ScopedNestableTaskAllower allow(message_loop_);
42 message_loop_->SetNestableTasksAllowed(true);
43 message_loop_->Run(); 42 message_loop_->Run();
44 message_loop_->SetNestableTasksAllowed(old_state);
45 } 43 }
46 virtual void quitNow() { 44 virtual void quitNow() {
47 message_loop_->QuitNow(); 45 message_loop_->QuitNow();
48 } 46 }
49 private: 47 private:
50 MessageLoop* message_loop_; 48 MessageLoop* message_loop_;
51 }; 49 };
52 50
53 typedef std::map<int, DevToolsAgent*> IdToAgentMap; 51 typedef std::map<int, DevToolsAgent*> IdToAgentMap;
54 base::LazyInstance<IdToAgentMap>::Leaky 52 base::LazyInstance<IdToAgentMap>::Leaky
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 177 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
180 WebView* web_view = render_view()->GetWebView(); 178 WebView* web_view = render_view()->GetWebView();
181 if (!web_view) 179 if (!web_view)
182 return NULL; 180 return NULL;
183 return web_view->devToolsAgent(); 181 return web_view->devToolsAgent();
184 } 182 }
185 183
186 bool DevToolsAgent::IsAttached() { 184 bool DevToolsAgent::IsAttached() {
187 return is_attached_; 185 return is_attached_;
188 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698