diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
---|---|---|
committer | Zeno Albisser <zeno.albisser@digia.com> | 2013-08-15 21:46:11 +0200 |
commit | 679147eead574d186ebf3069647b4c23e8ccace6 (patch) | |
tree | fc247a0ac8ff119f7c8550879ebb6d3dd8d1ff69 /chromium/content/renderer/devtools/devtools_agent_filter.h | |
download | qtwebengine-chromium-679147eead574d186ebf3069647b4c23e8ccace6.tar.gz |
Initial import.
Diffstat (limited to 'chromium/content/renderer/devtools/devtools_agent_filter.h')
-rw-r--r-- | chromium/content/renderer/devtools/devtools_agent_filter.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/chromium/content/renderer/devtools/devtools_agent_filter.h b/chromium/content/renderer/devtools/devtools_agent_filter.h new file mode 100644 index 00000000000..e7f78613807 --- /dev/null +++ b/chromium/content/renderer/devtools/devtools_agent_filter.h @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ +#define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ + +#include <string> + +#include "ipc/ipc_channel_proxy.h" + +struct DevToolsMessageData; + +namespace base { +class MessageLoop; +} + +namespace content { + +// DevToolsAgentFilter is registered as an IPC filter in order to be able to +// dispatch messages while on the IO thread. The reason for that is that while +// debugging, Render thread is being held by the v8 and hence no messages +// are being dispatched there. While holding the thread in a tight loop, +// v8 provides thread-safe Api for controlling debugger. In our case v8's Api +// is being used from this communication agent on the IO thread. +class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { + public: + // There is a single instance of this class instantiated by the RenderThread. + DevToolsAgentFilter(); + + static void SendRpcMessage(const DevToolsMessageData& data); + + // IPC::ChannelProxy::MessageFilter override. Called on IO thread. + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + + protected: + virtual ~DevToolsAgentFilter(); + + private: + void OnDispatchOnInspectorBackend(const std::string& message); + + bool message_handled_; + base::MessageLoop* render_thread_loop_; + int current_routing_id_; + + DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter); +}; + +} // namespace content + +#endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ |