diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-04 16:57:45 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-04 16:57:45 +0000 |
commit | c37702ae4396f1db67d621fa7434c7b335abda8e (patch) | |
tree | 2eb02b6971ae1a08e6112a1dd40774b8658055a5 /content/browser/debugger | |
parent | 610f904d8215075c4681be4eb413f4348860bf9f (diff) | |
download | chromium_src-c37702ae4396f1db67d621fa7434c7b335abda8e.zip chromium_src-c37702ae4396f1db67d621fa7434c7b335abda8e.tar.gz chromium_src-c37702ae4396f1db67d621fa7434c7b335abda8e.tar.bz2 |
Revert "DevTools: introduce Reattach message, get rid of DevToolsRuntimeProperties map"
This reverts commit 103920. WebKit dependency is not updated yet.
BUG=
TEST=
Review URL: http://codereview.chromium.org/8137004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/debugger')
-rw-r--r-- | content/browser/debugger/devtools_agent_host.cc | 10 | ||||
-rw-r--r-- | content/browser/debugger/devtools_agent_host.h | 3 | ||||
-rw-r--r-- | content/browser/debugger/devtools_manager.cc | 39 | ||||
-rw-r--r-- | content/browser/debugger/devtools_manager.h | 18 | ||||
-rw-r--r-- | content/browser/debugger/render_view_devtools_agent_host.cc | 12 | ||||
-rw-r--r-- | content/browser/debugger/render_view_devtools_agent_host.h | 3 |
6 files changed, 51 insertions, 34 deletions
diff --git a/content/browser/debugger/devtools_agent_host.cc b/content/browser/debugger/devtools_agent_host.cc index 0d206c9..50edfd9 100644 --- a/content/browser/debugger/devtools_agent_host.cc +++ b/content/browser/debugger/devtools_agent_host.cc @@ -10,14 +10,10 @@ DevToolsAgentHost::DevToolsAgentHost() : close_listener_(NULL) { } -void DevToolsAgentHost::Attach() { - SendMessageToAgent(new DevToolsAgentMsg_Attach(MSG_ROUTING_NONE)); -} - -void DevToolsAgentHost::Reattach(const std::string& saved_agent_state) { - SendMessageToAgent(new DevToolsAgentMsg_Reattach( +void DevToolsAgentHost::Attach(const DevToolsRuntimeProperties& properties) { + SendMessageToAgent(new DevToolsAgentMsg_Attach( MSG_ROUTING_NONE, - saved_agent_state)); + properties)); } void DevToolsAgentHost::Detach() { diff --git a/content/browser/debugger/devtools_agent_host.h b/content/browser/debugger/devtools_agent_host.h index 3eb7a33..848de04 100644 --- a/content/browser/debugger/devtools_agent_host.h +++ b/content/browser/debugger/devtools_agent_host.h @@ -29,8 +29,7 @@ class CONTENT_EXPORT DevToolsAgentHost { // Sends the message to the devtools agent hosted by this object. virtual void SendMessageToAgent(IPC::Message* msg) = 0; - virtual void Attach(); - virtual void Reattach(const std::string& saved_agent_state); + virtual void Attach(const DevToolsRuntimeProperties&); virtual void Detach(); // TODO(yurys): get rid of this method diff --git a/content/browser/debugger/devtools_manager.cc b/content/browser/debugger/devtools_manager.cc index 87e9ff7..53a1684 100644 --- a/content/browser/debugger/devtools_manager.cc +++ b/content/browser/debugger/devtools_manager.cc @@ -63,8 +63,8 @@ void DevToolsManager::RegisterDevToolsClientHostFor( void DevToolsManager::RegisterDevToolsClientHostFor( DevToolsAgentHost* agent_host, DevToolsClientHost* client_host) { - BindClientHost(agent_host, client_host); - agent_host->Attach(); + DevToolsRuntimeProperties initial_properties; + BindClientHost(agent_host, client_host, initial_properties); client_host->set_close_listener(this); } @@ -89,9 +89,18 @@ void DevToolsManager::ForwardToDevToolsClient(DevToolsAgentHost* agent_host, client_host->SendMessageToClient(message); } -void DevToolsManager::SaveAgentRuntimeState(DevToolsAgentHost* agent_host, - const std::string& state) { - agent_runtime_states_[agent_host] = state; +void DevToolsManager::RuntimePropertyChanged(DevToolsAgentHost* agent_host, + const std::string& name, + const std::string& value) { + RuntimePropertiesMap::iterator it = + runtime_properties_map_.find(agent_host); + if (it == runtime_properties_map_.end()) { + std::pair<DevToolsAgentHost*, DevToolsRuntimeProperties> value( + agent_host, + DevToolsRuntimeProperties()); + it = runtime_properties_map_.insert(value).first; + } + it->second[name] = value; } void DevToolsManager::ClientHostClosing(DevToolsClientHost* client_host) { @@ -180,8 +189,8 @@ int DevToolsManager::DetachClientHost(RenderViewHost* from_rvh) { int cookie = last_orphan_cookie_++; orphan_client_hosts_[cookie] = - std::pair<DevToolsClientHost*, std::string>( - client_host, agent_runtime_states_[agent_host]); + std::pair<DevToolsClientHost*, DevToolsRuntimeProperties>( + client_host, runtime_properties_map_[agent_host]); UnbindClientHost(agent_host, client_host); return cookie; @@ -195,16 +204,17 @@ void DevToolsManager::AttachClientHost(int client_host_cookie, return; DevToolsClientHost* client_host = (*it).second.first; - DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor(to_rvh); - BindClientHost(agent_host, client_host); - agent_host->Reattach((*it).second.second); + DevToolsAgentHost* agent_host = RenderViewDevToolsAgentHost::FindFor( + to_rvh); + BindClientHost(agent_host, client_host, (*it).second.second); - orphan_client_hosts_.erase(it); + orphan_client_hosts_.erase(client_host_cookie); } void DevToolsManager::BindClientHost( DevToolsAgentHost* agent_host, - DevToolsClientHost* client_host) { + DevToolsClientHost* client_host, + const DevToolsRuntimeProperties& runtime_properties) { DCHECK(agent_to_client_host_.find(agent_host) == agent_to_client_host_.end()); DCHECK(client_to_agent_host_.find(client_host) == @@ -218,11 +228,14 @@ void DevToolsManager::BindClientHost( } agent_to_client_host_[agent_host] = client_host; client_to_agent_host_[client_host] = agent_host; + runtime_properties_map_[agent_host] = runtime_properties; agent_host->set_close_listener(this); int process_id = agent_host->GetRenderProcessId(); if (process_id != -1) ChildProcessSecurityPolicy::GetInstance()->GrantReadRawCookies(process_id); + + agent_host->Attach(runtime_properties); } void DevToolsManager::UnbindClientHost(DevToolsAgentHost* agent_host, @@ -236,7 +249,7 @@ void DevToolsManager::UnbindClientHost(DevToolsAgentHost* agent_host, agent_to_client_host_.erase(agent_host); client_to_agent_host_.erase(client_host); - agent_runtime_states_.erase(agent_host); + runtime_properties_map_.erase(agent_host); if (client_to_agent_host_.empty()) { BrowserThread::PostTask( diff --git a/content/browser/debugger/devtools_manager.h b/content/browser/debugger/devtools_manager.h index 623e0c9..1104203 100644 --- a/content/browser/debugger/devtools_manager.h +++ b/content/browser/debugger/devtools_manager.h @@ -25,6 +25,8 @@ class PrefService; class RenderViewHost; class TabContents; +typedef std::map<std::string, std::string> DevToolsRuntimeProperties; + // This class is a singleton that manages DevToolsClientHost instances and // routes messages between developer tools clients and agents. // @@ -55,8 +57,9 @@ class CONTENT_EXPORT DevToolsManager void ForwardToDevToolsClient(DevToolsAgentHost* agent_host, const IPC::Message& message); - void SaveAgentRuntimeState(DevToolsAgentHost* agent_host, - const std::string& state); + void RuntimePropertyChanged(DevToolsAgentHost* agent_host, + const std::string& name, + const std::string& value); // Sends 'Attach' message to the agent using |dest_rvh| in case // there is a DevToolsClientHost registered for the |inspected_rvh|. @@ -98,7 +101,8 @@ class CONTENT_EXPORT DevToolsManager DevToolsAgentHost* GetAgentHost(DevToolsClientHost* client_host); void BindClientHost(DevToolsAgentHost* agent_host, - DevToolsClientHost* client_host); + DevToolsClientHost* client_host, + const DevToolsRuntimeProperties& runtime_properties); void UnbindClientHost(DevToolsAgentHost* agent_host, DevToolsClientHost* client_host); @@ -116,10 +120,12 @@ class CONTENT_EXPORT DevToolsManager ClientHostToInspectedRvhMap; ClientHostToInspectedRvhMap client_to_agent_host_; - typedef std::map<DevToolsAgentHost*, std::string> AgentRuntimeStates; - AgentRuntimeStates agent_runtime_states_; + typedef std::map<DevToolsAgentHost*, DevToolsRuntimeProperties> + RuntimePropertiesMap; + RuntimePropertiesMap runtime_properties_map_; - typedef std::map<int, std::pair<DevToolsClientHost*, std::string> > + typedef std::map<int, + std::pair<DevToolsClientHost*, DevToolsRuntimeProperties> > OrphanClientHosts; OrphanClientHosts orphan_client_hosts_; int last_orphan_cookie_; diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc index a9937da..188756a 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.cc +++ b/content/browser/debugger/render_view_devtools_agent_host.cc @@ -78,8 +78,8 @@ bool RenderViewDevToolsAgentHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP(RenderViewDevToolsAgentHost, message) IPC_MESSAGE_HANDLER(DevToolsHostMsg_ForwardToClient, OnForwardToClient) - IPC_MESSAGE_HANDLER(DevToolsHostMsg_SaveAgentRuntimeState, - OnSaveAgentRuntimeState) + IPC_MESSAGE_HANDLER(DevToolsHostMsg_RuntimePropertyChanged, + OnRuntimePropertyChanged) IPC_MESSAGE_HANDLER(DevToolsHostMsg_ClearBrowserCache, OnClearBrowserCache) IPC_MESSAGE_HANDLER(DevToolsHostMsg_ClearBrowserCookies, OnClearBrowserCookies) @@ -88,9 +88,11 @@ bool RenderViewDevToolsAgentHost::OnMessageReceived( return handled; } -void RenderViewDevToolsAgentHost::OnSaveAgentRuntimeState( - const std::string& state) { - DevToolsManager::GetInstance()->SaveAgentRuntimeState(this, state); +void RenderViewDevToolsAgentHost::OnRuntimePropertyChanged( + const std::string& name, + const std::string& value) { + DevToolsManager::GetInstance()->RuntimePropertyChanged( + this, name, value); } void RenderViewDevToolsAgentHost::OnForwardToClient( diff --git a/content/browser/debugger/render_view_devtools_agent_host.h b/content/browser/debugger/render_view_devtools_agent_host.h index 329369b..0a3193c 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.h +++ b/content/browser/debugger/render_view_devtools_agent_host.h @@ -36,7 +36,8 @@ class CONTENT_EXPORT RenderViewDevToolsAgentHost virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; void OnForwardToClient(const IPC::Message& message); - void OnSaveAgentRuntimeState(const std::string& state); + void OnRuntimePropertyChanged(const std::string& name, + const std::string& value); void OnClearBrowserCache(); void OnClearBrowserCookies(); |