diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 17:12:12 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-18 17:12:12 +0000 |
commit | fb452133d3571bc94e725fdb5aee3f812a16e40e (patch) | |
tree | e4daa02ceb3f765a256621e192e02a69a03314b7 /chrome/renderer | |
parent | 5f9b70e7fe486eaa6726703c9857d02a954e07d8 (diff) | |
download | chromium_src-fb452133d3571bc94e725fdb5aee3f812a16e40e.zip chromium_src-fb452133d3571bc94e725fdb5aee3f812a16e40e.tar.gz chromium_src-fb452133d3571bc94e725fdb5aee3f812a16e40e.tar.bz2 |
Reverting 9944.
This change broke ui, interactive and Vista Perf tests. I felt like reverting.
Review URL: http://codereview.chromium.org/24020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9947 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 29 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 15 | ||||
-rw-r--r-- | chrome/renderer/renderer.scons | 5 | ||||
-rw-r--r-- | chrome/renderer/renderer.vcproj | 20 | ||||
-rw-r--r-- | chrome/renderer/tools_agent.cc | 138 | ||||
-rw-r--r-- | chrome/renderer/tools_agent.h | 67 | ||||
-rw-r--r-- | chrome/renderer/tools_client.cc | 82 | ||||
-rw-r--r-- | chrome/renderer/tools_client.h | 60 | ||||
-rw-r--r-- | chrome/renderer/tools_messages.h | 22 |
9 files changed, 0 insertions, 438 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 1fa3650..a8adb2f 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -11,7 +11,6 @@ #include "base/command_line.h" #include "base/gfx/png_encoder.h" #include "base/gfx/native_widget_types.h" -#include "base/process_util.h" #include "base/string_piece.h" #include "base/string_util.h" #include "build/build_config.h" @@ -26,7 +25,6 @@ #include "chrome/common/thumbnail_score.h" #include "chrome/renderer/about_handler.h" #include "chrome/renderer/debug_message_handler.h" -#include "chrome/renderer/tools_client.h" #include "chrome/renderer/localized_error.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/user_script_slave.h" @@ -170,9 +168,6 @@ RenderView::RenderView(RenderThreadBase* render_thread) method_factory_(this), first_default_plugin_(NULL), printed_document_width_(0), - tools_agent_(NULL), - enable_tools_client_(false), - tools_client_(NULL), history_back_list_count_(0), history_forward_list_count_(0), disable_popup_blocking_(false), @@ -201,10 +196,6 @@ RenderView::~RenderView() { } render_thread_->RemoveFilter(debug_message_handler_); - render_thread_->RemoveFilter(tools_agent_); - if (tools_client_.get()) { - render_thread_->RemoveFilter(tools_client_); - } #ifdef CHROME_PERSONALIZATION Personalization::CleanupRendererPersonalization(personalization_); @@ -322,9 +313,6 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, debug_message_handler_ = new DebugMessageHandler(this); render_thread_->AddFilter(debug_message_handler_); - - tools_agent_ = new ToolsAgent(this); - render_thread_->AddFilter(tools_agent_); } void RenderView::OnMessageReceived(const IPC::Message& message) { @@ -367,7 +355,6 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) IPC_MESSAGE_HANDLER(ViewMsg_InspectElement, OnInspectElement) IPC_MESSAGE_HANDLER(ViewMsg_ShowJavaScriptConsole, OnShowJavaScriptConsole) - IPC_MESSAGE_HANDLER(ViewMsg_SetUpToolsClient, OnSetUpToolsClient) IPC_MESSAGE_HANDLER(ViewMsg_DownloadImage, OnDownloadImage) IPC_MESSAGE_HANDLER(ViewMsg_ScriptEvalRequest, OnScriptEvalRequest) IPC_MESSAGE_HANDLER(ViewMsg_AddMessageToConsole, OnAddMessageToConsole) @@ -910,10 +897,6 @@ void RenderView::OnShowJavaScriptConsole() { webview()->ShowJavaScriptConsole(); } -void RenderView::OnSetUpToolsClient() { - enable_tools_client_ = true; -} - void RenderView::OnStopFinding(bool clear_selection) { WebView* view = webview(); if (!view) @@ -1519,13 +1502,6 @@ void RenderView::BindDOMAutomationController(WebFrame* webframe) { L"domAutomationController"); } -void RenderView::CreateToolsClient() { - DCHECK(!tools_client_.get()); - tools_client_ = new ToolsClient(this); - webview()->SetUpToolsProxy(tools_client_); - render_thread_->AddFilter(tools_client_); -} - void RenderView::WindowObjectCleared(WebFrame* webframe) { external_js_object_.set_render_view(this); external_js_object_.BindToJavascript(webframe, L"external"); @@ -1541,11 +1517,6 @@ void RenderView::WindowObjectCleared(WebFrame* webframe) { external_host_bindings_.set_routing_id(routing_id_); external_host_bindings_.BindToJavascript(webframe, L"externalHost"); } - // TODO(yurys): we wouldn't need to check that tools_client_ is not set yet if - // WindowObjectCleared were not called several times recursively - if (enable_tools_client_ && !tools_client_.get()) { - CreateToolsClient(); - } #ifdef CHROME_PERSONALIZATION Personalization::ConfigureRendererPersonalization(personalization_, this, diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 64e0caa..6cafaa6 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -22,8 +22,6 @@ #include "chrome/renderer/dom_ui_bindings.h" #include "chrome/renderer/external_host_bindings.h" #include "chrome/renderer/external_js_object.h" -#include "chrome/renderer/tools_agent.h" -#include "chrome/renderer/tools_client.h" #include "chrome/renderer/render_widget.h" #include "testing/gtest/include/gtest/gtest_prod.h" #include "webkit/glue/console_message_level.h" @@ -440,7 +438,6 @@ class RenderView : public RenderWidget, void OnCopyImageAt(int x, int y); void OnInspectElement(int x, int y); void OnShowJavaScriptConsole(); - void OnSetUpToolsClient(); void OnCancelDownload(int32 download_id); void OnFind(const FindInPageRequest& request); void OnZoom(int function); @@ -554,10 +551,6 @@ class RenderView : public RenderWidget, // information to the browser process. void BindDOMAutomationController(WebFrame* webframe); - // Creates ToolsClient and sets up JavaScript bindings for developer tools UI - // that is going to be hosted by this RenderView. - void CreateToolsClient(); - void set_opened_by_user_gesture(bool value) { opened_by_user_gesture_ = value; } @@ -700,14 +693,6 @@ class RenderView : public RenderWidget, scoped_refptr<DebugMessageHandler> debug_message_handler_; - // Provides access to this renderer from the remote Inspector UI. - scoped_refptr<ToolsAgent> tools_agent_; - - // Whether this renderer will serve as Inspector UI. - bool enable_tools_client_; - - scoped_refptr<ToolsClient> tools_client_; - scoped_ptr<WebFileChooserCallback> file_chooser_; int history_back_list_count_; diff --git a/chrome/renderer/renderer.scons b/chrome/renderer/renderer.scons index f1ed92f..4f5ba60 100644 --- a/chrome/renderer/renderer.scons +++ b/chrome/renderer/renderer.scons @@ -79,11 +79,6 @@ input_files = ChromeFileList([ 'renderer_glue.cc', 'renderer_main.cc', 'renderer_resources.h', - 'tools_agent.cc', - 'tools_agent.h', - 'tools_client.cc', - 'tools_client.h', - 'tools_messages.h', 'user_script_slave.cc', 'user_script_slave.h', 'visitedlink_slave.cc', diff --git a/chrome/renderer/renderer.vcproj b/chrome/renderer/renderer.vcproj index 8a1dc13..7e50f8f 100644 --- a/chrome/renderer/renderer.vcproj +++ b/chrome/renderer/renderer.vcproj @@ -310,26 +310,6 @@ > </File> <File - RelativePath=".\tools_agent.cc" - > - </File> - <File - RelativePath=".\tools_agent.h" - > - </File> - <File - RelativePath=".\tools_client.cc" - > - </File> - <File - RelativePath=".\tools_client.h" - > - </File> - <File - RelativePath=".\tools_messages.h" - > - </File> - <File RelativePath=".\user_script_slave.cc" > </File> diff --git a/chrome/renderer/tools_agent.cc b/chrome/renderer/tools_agent.cc deleted file mode 100644 index db622ca..0000000 --- a/chrome/renderer/tools_agent.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2009 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.
-
-#include "chrome/renderer/tools_agent.h"
-
-#include "chrome/common/render_messages.h"
-// TODO(yurys): remove this macros once plugins available on other platforms
-#if defined(OS_WIN)
-#include "chrome/renderer/plugin_channel_host.h"
-#endif // OS_WIN
-#include "chrome/renderer/render_process.h"
-#include "chrome/renderer/render_view.h"
-
-ToolsAgent::ToolsAgent(RenderView* view)
- : debugger_(NULL),
- view_(view),
- view_loop_(g_render_thread->message_loop()) {
-}
-
-ToolsAgent::~ToolsAgent() {
-}
-
-void ToolsAgent::Send(ToolsClientMessageType message_type,
- const std::wstring& body) {
- view_->Send(new ViewHostMsg_ToolsClientMsg(
- view_->routing_id(), message_type, body));
-}
-
-// Called on IO thread.
-bool ToolsAgent::OnMessageReceived(const IPC::Message& message) {
- if (message.routing_id() != view_->routing_id())
- return false;
-
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ToolsAgent, message)
- IPC_MESSAGE_HANDLER(ViewMsg_ToolsAgentMsg, OnToolsAgentMsg)
- IPC_MESSAGE_UNHANDLED(handled = false);
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-// Called on IO thread.
-void ToolsAgent::OnToolsAgentMsg(int tools_message_type,
- const std::wstring& body) {
- view_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this,
- &ToolsAgent::HandleMessageInRenderThread,
- tools_message_type,
- body));
-}
-
-void ToolsAgent::HandleMessageInRenderThread(
- int tools_message_type, const std::wstring& body) {
- DCHECK(MessageLoop::current() == view_loop_);
-
- switch (tools_message_type) {
- case TOOLS_AGENT_MSG_DEBUG_ATTACH:
- OnDebugAttach();
- break;
- case TOOLS_AGENT_MSG_DEBUG_DETACH:
- OnDebugDetach();
- break;
- case TOOLS_AGENT_MSG_DEBUG_BREAK:
- OnDebugBreak(body == L"true");
- break;
- case TOOLS_AGENT_MSG_DEBUG_COMMAND:
- OnCommand(body);
- break;
- default:
- NOTREACHED() << "Unknown ToolsAgentMessageType: " << tools_message_type;
- }
-}
-
-void ToolsAgent::DebuggerOutput(const std::wstring& out) {
- Send(TOOLS_CLIENT_MSG_DEBUGGER_OUTPUT, out);
-}
-
-void ToolsAgent::EvaluateScript(const std::wstring& script) {
- DCHECK(MessageLoop::current() == view_loop_);
- // It's possible that this will get cleared out from under us.
- view_->EvaluateScript(L"", script);
-}
-
-void ToolsAgent::OnDebugAttach() {
- DCHECK(MessageLoop::current() == view_loop_);
- if (!debugger_) {
- debugger_ = new DebuggerBridge(this);
- }
-
- debugger_->Attach();
-
- Send(TOOLS_CLIENT_MSG_DID_DEBUG_ATTACH, L"");
-
-// TODO(yurys): remove this macros once plugins available on other platforms
-#if defined(OS_WIN)
- // Tell the plugin host to stop accepting messages in order to avoid
- // hangs while the renderer is paused.
- // TODO(yurys): It might be an improvement to add more plumbing to do this
- // when the renderer is actually paused vs. just the debugger being attached.
- // http://code.google.com/p/chromium/issues/detail?id=7556
- PluginChannelHost::SetListening(false);
-#endif // OS_WIN
-}
-
-void ToolsAgent::OnDebugDetach() {
- DCHECK(MessageLoop::current() == view_loop_);
- if (debugger_)
- debugger_->Detach();
-// TODO(yurys): remove this macros once plugins available on other platforms
-#if defined(OS_WIN)
- PluginChannelHost::SetListening(true);
-#endif // OS_WIN
-}
-
-void ToolsAgent::OnDebugBreak(bool force) {
- DCHECK(MessageLoop::current() == view_loop_);
- // Set the debug break flag in the V8 engine.
- debugger_->Break(force);
-
- // If a forced break has been requested make sure that it will occour by
- // running some JavaScript in the renderer.
- if (force)
- EvaluateScript(std::wstring(L"javascript:void(0)"));
-}
-
-void ToolsAgent::OnCommand(const std::wstring& cmd) {
- DCHECK(MessageLoop::current() == view_loop_);
- if (!debugger_) {
- NOTREACHED();
- std::wstring msg =
- StringPrintf(L"before attach, ignored command (%S)", cmd.c_str());
- DebuggerOutput(msg);
- } else {
- debugger_->Command(cmd);
- }
-}
-
diff --git a/chrome/renderer/tools_agent.h b/chrome/renderer/tools_agent.h deleted file mode 100644 index 6a4aeb6..0000000 --- a/chrome/renderer/tools_agent.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2009 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 CHROME_RENDERER_TOOLS_AGENT_H_
-#define CHROME_RENDERER_TOOLS_AGENT_H_
-
-#include "base/basictypes.h"
-#include "base/message_loop.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "chrome/common/ipc_channel_proxy.h"
-#include "chrome/renderer/tools_messages.h"
-#include "webkit/glue/debugger_bridge.h"
-
-class Message;
-class RenderView;
-
-// Inspected page end of communication channel between the render process of
-// the page being inspected and tools UI renderer process. All messages will
-// go through browser process. On the renderer side of the tools UI there's
-// a corresponding ToolsClient object.
-class ToolsAgent : public IPC::ChannelProxy::MessageFilter,
- public DebuggerBridge::Delegate {
- public:
- // ToolsAgent is a field of the RenderView. The view is supposed to be alive
- // at least until OnFilterRemoved method is called.
- explicit ToolsAgent(RenderView* view);
- virtual ~ToolsAgent();
-
- private:
- // Sends message to ToolsClient.
- void Send(ToolsClientMessageType message_type, const std::wstring& body);
-
- // IPC::ChannelProxy::MessageFilter overrides:
- virtual bool OnMessageReceived(const IPC::Message& message);
-
- // Called on IO thread.
- void OnToolsAgentMsg(int tools_message_type, const std::wstring& body);
-
- // Message filer's OnMessageReceived method is called on IO thread while
- // ToolsAgent messages have to be handled in render thread. This method is
- // called in render thread to handle tools agent message.
- void HandleMessageInRenderThread(int tools_message_type,
- const std::wstring& body);
-
- // Debugger::Delegate callback method to handle debugger output.
- void DebuggerOutput(const std::wstring& out);
-
- // Evaluate javascript URL in the renderer
- void EvaluateScript(const std::wstring& script);
-
- // All these OnXXX methods must be executed in render thread.
- void OnDebugAttach();
- void OnDebugDetach();
- void OnDebugBreak(bool force);
- void OnCommand(const std::wstring& cmd);
-
- scoped_refptr<DebuggerBridge> debugger_;
- RenderView* view_;
- MessageLoop* view_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(ToolsAgent);
-};
-
-#endif // CHROME_RENDERER_TOOLS_AGENT_H_
-
diff --git a/chrome/renderer/tools_client.cc b/chrome/renderer/tools_client.cc deleted file mode 100644 index c33e2f0..0000000 --- a/chrome/renderer/tools_client.cc +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2009 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.
-
-#include "chrome/renderer/tools_client.h"
-
-#include "chrome/common/render_messages.h"
-#include "chrome/renderer/render_view.h"
-#include "webkit/glue/tools_proxy.h"
-
-ToolsClient::ToolsClient(RenderView* view)
- : tools_ui_(NULL),
- render_view_(view),
- view_loop_(MessageLoop::current()) {
-}
-
-ToolsClient::~ToolsClient() {
- tools_ui_ = NULL;
-}
-
-void ToolsClient::Send(ToolsAgentMessageType message_type,
- const std::wstring& json_arg) {
- render_view_->Send(new ViewHostMsg_ToolsAgentMsg(
- render_view_->routing_id(), message_type, json_arg));
-}
-
-// IPC::ChannelProxy::MessageFilter overrides:
-bool ToolsClient::OnMessageReceived(const IPC::Message& message) {
- if (message.routing_id() != render_view_->routing_id()) {
- NOTREACHED();
- return false;
- }
-
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ToolsClient, message)
- IPC_MESSAGE_HANDLER(ViewMsg_ToolsClientMsg, OnToolsClientMessage)
- IPC_MESSAGE_UNHANDLED(handled = false);
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void ToolsClient::OnToolsClientMessage(int tools_message_type,
- const std::wstring& body) {
- view_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this,
- &ToolsClient::HandleMessageInRenderThread,
- tools_message_type,
- body));
-}
-
-void ToolsClient::HandleMessageInRenderThread(int tools_message_type,
- const std::wstring& body) {
- DCHECK(view_loop_ == MessageLoop::current());
-
- switch (tools_message_type) {
- case TOOLS_CLIENT_MSG_DID_DEBUG_ATTACH:
- OnDidDebugAttach();
- break;
- default:
- NOTREACHED() << "Unknown message type: " << tools_message_type;
- }
-}
-
-void ToolsClient::OnDidDebugAttach() {
- DCHECK(view_loop_ == MessageLoop::current());
- if (tools_ui_)
- tools_ui_->OnDidDebugAttach();
-}
-
-// DebuggerProxy methods:
-void ToolsClient::SetToolsUI(ToolsUI* tools_ui) {
- tools_ui_ = tools_ui;
-}
-
-void ToolsClient::DebugAttach() {
- Send(TOOLS_AGENT_MSG_DEBUG_ATTACH, L"");
-}
-
-void ToolsClient::DebugDetach() {
- Send(TOOLS_AGENT_MSG_DEBUG_DETACH, L"");
-}
-
diff --git a/chrome/renderer/tools_client.h b/chrome/renderer/tools_client.h deleted file mode 100644 index 26894ae..0000000 --- a/chrome/renderer/tools_client.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2009 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 CHROME_RENDERER_TOOLS_CLIENT_H_
-#define CHROME_RENDERER_TOOLS_CLIENT_H_
-
-#include "base/basictypes.h"
-#include "base/ref_counted.h"
-#include "base/scoped_ptr.h"
-#include "chrome/common/ipc_channel_proxy.h"
-#include "chrome/renderer/tools_messages.h"
-#include "webkit/glue/tools_proxy.h"
-
-class MessageLoop;
-class RenderView;
-
-// Developer tools UI end of communication channel between the render process of
-// the page being inspected and tools UI renderer process. All messages will
-// go through browser process. On the side of the inspected page there's
-// corresponding ToolsAgent object.
-class ToolsClient : public ToolsProxy,
- public IPC::ChannelProxy::MessageFilter {
- public:
- explicit ToolsClient(RenderView* view);
- virtual ~ToolsClient();
-
- private:
- // DebuggerProxy overrides
- virtual void SetToolsUI(ToolsUI* tools_ui);
- virtual void DebugAttach();
- virtual void DebugDetach();
-
- // All these OnXXX methods must be executed in render thread.
- void OnDidDebugAttach();
-
- // Sends message to ToolsAgent.
- void Send(ToolsAgentMessageType message_type, const std::wstring& json_arg);
-
- // IPC::ChannelProxy::MessageFilter overrides:
- virtual bool OnMessageReceived(const IPC::Message& message);
-
- // Called on IO thread.
- void OnToolsClientMessage(int tools_message_type, const std::wstring& body);
-
- // Message filer's OnMessageReceived method is called on IO thread while
- // ToolsClient messages have to be handled in render thread. This method is
- // called in render thread to handle tools client message.
- void HandleMessageInRenderThread(int tools_message_type,
- const std::wstring& body);
-
- ToolsUI* tools_ui_;
- RenderView* render_view_;
- MessageLoop* view_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(ToolsClient);
-};
-
-#endif // CHROME_RENDERER_TOOLS_CLIENT_H_
-
diff --git a/chrome/renderer/tools_messages.h b/chrome/renderer/tools_messages.h deleted file mode 100644 index 3f6d41d..0000000 --- a/chrome/renderer/tools_messages.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2009 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 CHROME_RENDERER_TOOLS_MESSAGES_H_
-#define CHROME_RENDERER_TOOLS_MESSAGES_H_
-
-enum ToolsAgentMessageType {
- TOOLS_AGENT_MSG_DEBUG_ATTACH = 0,
- TOOLS_AGENT_MSG_DEBUG_BREAK,
- TOOLS_AGENT_MSG_DEBUG_COMMAND,
- TOOLS_AGENT_MSG_DEBUG_DETACH
-};
-
-enum ToolsClientMessageType {
- TOOLS_CLIENT_MSG_ADD_MESSAGE_TO_CONSOLE = 0,
- TOOLS_CLIENT_MSG_DEBUGGER_OUTPUT,
- TOOLS_CLIENT_MSG_DID_DEBUG_ATTACH
-};
-
-#endif // CHROME_RENDERER_TOOLS_MESSAGES_H_
-
|