summaryrefslogtreecommitdiffstats
path: root/webkit/support/webkit_support.cc
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 23:29:45 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 23:29:45 +0000
commit8d8a5eb7170f38c8cab2006502282c6b58288ef0 (patch)
tree7c922802885882b6c0023f7fe6006c7d0179520f /webkit/support/webkit_support.cc
parente95c0454d924e6e59b06255421ba50d97ac6eb80 (diff)
downloadchromium_src-8d8a5eb7170f38c8cab2006502282c6b58288ef0.zip
chromium_src-8d8a5eb7170f38c8cab2006502282c6b58288ef0.tar.gz
chromium_src-8d8a5eb7170f38c8cab2006502282c6b58288ef0.tar.bz2
webkit_support: Add CreateDevToolsMessageLoop(), which is a helper
function for WebDevToolsAgentClient::createClientMessageLoop(). The implementation is identical with r50233. http://src.chromium.org/viewvc/chrome/trunk/src/webkit/tools/test_shell/test_shell_devtools_agent.cc?view=diff&r1=50232&r2=50233 BUG=none TEST=none Review URL: http://codereview.chromium.org/3162044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/webkit_support.cc')
-rw-r--r--webkit/support/webkit_support.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 8199678..20dcb06 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -47,6 +47,7 @@
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
using WebKit::WebCString;
+using WebKit::WebDevToolsAgentClient;
using WebKit::WebFrame;
using WebKit::WebMediaPlayerClient;
using WebKit::WebPlugin;
@@ -160,6 +161,26 @@ FilePath GetWebKitRootDirFilePath() {
}
}
+class WebKitClientMessageLoopImpl
+ : public WebDevToolsAgentClient::WebKitClientMessageLoop {
+ public:
+ WebKitClientMessageLoopImpl() : message_loop_(MessageLoop::current()) {}
+ virtual ~WebKitClientMessageLoopImpl() {
+ message_loop_ = NULL;
+ }
+ virtual void run() {
+ bool old_state = message_loop_->NestableTasksAllowed();
+ message_loop_->SetNestableTasksAllowed(true);
+ message_loop_->Run();
+ message_loop_->SetNestableTasksAllowed(old_state);
+ }
+ virtual void quitNow() {
+ message_loop_->QuitNow();
+ }
+ private:
+ MessageLoop* message_loop_;
+};
+
} // namespace
namespace webkit_support {
@@ -329,6 +350,10 @@ void DispatchMessageLoop() {
current->SetNestableTasksAllowed(old_state);
}
+WebDevToolsAgentClient::WebKitClientMessageLoop* CreateDevToolsMessageLoop() {
+ return new WebKitClientMessageLoopImpl();
+}
+
void PostTaskFromHere(Task* task) {
MessageLoop::current()->PostTask(FROM_HERE, task);
}