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

Side by Side Diff: webkit/glue/webdevtoolsagent_impl.cc

Issue 99121: Merge WebKit console and load deferrer changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.h ('k') | webkit/webkit.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "config.h" 5 #include "config.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "Document.h" 9 #include "Document.h"
10 #include "EventListener.h" 10 #include "EventListener.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Document* doc = page->mainFrame()->document(); 74 Document* doc = page->mainFrame()->document();
75 if (doc) { 75 if (doc) {
76 debugger_agent_impl_->SetDocument(doc); 76 debugger_agent_impl_->SetDocument(doc);
77 dom_agent_impl_->SetDocument(doc); 77 dom_agent_impl_->SetDocument(doc);
78 net_agent_impl_->SetDocument(doc); 78 net_agent_impl_->SetDocument(doc);
79 } 79 }
80 80
81 // Populate console. 81 // Populate console.
82 for (Vector<ConsoleMessage>::iterator it = console_log_.begin(); 82 for (Vector<ConsoleMessage>::iterator it = console_log_.begin();
83 it != console_log_.end(); ++it) { 83 it != console_log_.end(); ++it) {
84 tools_agent_delegate_stub_->AddMessageToConsole( 84 DictionaryValue message;
85 it->message, 85 Serialize(*it, &message);
86 it->source_id, 86 tools_agent_delegate_stub_->AddMessageToConsole(message);
87 it->line_no);
88 } 87 }
89 88
90 net_agent_impl_->Attach(); 89 net_agent_impl_->Attach();
91 attached_ = true; 90 attached_ = true;
92 } 91 }
93 92
94 void WebDevToolsAgentImpl::Detach() { 93 void WebDevToolsAgentImpl::Detach() {
95 debugger_agent_impl_.set(NULL); 94 debugger_agent_impl_.set(NULL);
96 dom_agent_impl_.set(NULL); 95 dom_agent_impl_.set(NULL);
97 net_agent_impl_->Detach(); 96 net_agent_impl_->Detach();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 const WebRequest& request = ds->GetRequest(); 129 const WebRequest& request = ds->GetRequest();
131 GURL url = ds->HasUnreachableURL() ? 130 GURL url = ds->HasUnreachableURL() ?
132 ds->GetUnreachableURL() : 131 ds->GetUnreachableURL() :
133 request.GetURL(); 132 request.GetURL();
134 tools_agent_delegate_stub_->FrameNavigate( 133 tools_agent_delegate_stub_->FrameNavigate(
135 url.possibly_invalid_spec(), 134 url.possibly_invalid_spec(),
136 webview->GetMainFrame() == frame); 135 webview->GetMainFrame() == frame);
137 } 136 }
138 137
139 void WebDevToolsAgentImpl::AddMessageToConsole( 138 void WebDevToolsAgentImpl::AddMessageToConsole(
140 const String& message, 139 int source,
141 const String& source_id, 140 int level,
142 unsigned int line_no) { 141 const String& text,
143 ConsoleMessage cm(message, source_id, line_no); 142 unsigned int line_no,
143 const String& source_id) {
144 ConsoleMessage cm(source, level, text, line_no, source_id);
144 console_log_.append(cm); 145 console_log_.append(cm);
145 if (console_log_.size() >= kMaxConsoleMessages) { 146 if (console_log_.size() >= kMaxConsoleMessages) {
146 // Batch shifts to save ticks. 147 // Batch shifts to save ticks.
147 console_log_.remove(0, kMaxConsoleMessages / 5); 148 console_log_.remove(0, kMaxConsoleMessages / 5);
148 } 149 }
149 if (attached_) { 150 if (attached_) {
150 tools_agent_delegate_stub_->AddMessageToConsole( 151 DictionaryValue message;
151 message, 152 Serialize(cm, &message);
152 source_id, 153 tools_agent_delegate_stub_->AddMessageToConsole(message);
153 line_no);
154 } 154 }
155 } 155 }
156 156
157 void WebDevToolsAgentImpl::ForceRepaint() { 157 void WebDevToolsAgentImpl::ForceRepaint() {
158 delegate_->ForceRepaint(); 158 delegate_->ForceRepaint();
159 } 159 }
160 160
161 void WebDevToolsAgentImpl::HighlightDOMNode(int node_id) { 161 void WebDevToolsAgentImpl::HighlightDOMNode(int node_id) {
162 if (!attached_) { 162 if (!attached_) {
163 return; 163 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 int node_id = dom_agent_impl_->PushNodePathToClient(node); 243 int node_id = dom_agent_impl_->PushNodePathToClient(node);
244 tools_agent_delegate_stub_->UpdateFocusedNode(node_id); 244 tools_agent_delegate_stub_->UpdateFocusedNode(node_id);
245 } 245 }
246 246
247 void WebDevToolsAgentImpl::SendRpcMessage(const std::string& raw_msg) { 247 void WebDevToolsAgentImpl::SendRpcMessage(const std::string& raw_msg) {
248 delegate_->SendMessageToClient(raw_msg); 248 delegate_->SendMessageToClient(raw_msg);
249 } 249 }
250 250
251 // static 251 // static
252 void WebDevToolsAgentImpl::Serialize(const ConsoleMessage& message,
253 DictionaryValue* value) {
254 value->SetInteger(L"source", message.source);
255 value->SetInteger(L"level", message.level);
256 value->SetString(L"text", webkit_glue::StringToStdString(message.text));
257 value->SetString(L"sourceId",
258 webkit_glue::StringToStdString(message.source_id));
259 value->SetInteger(L"line", message.line_no);
260 }
261
262 // static
252 void WebDevToolsAgent::ExecuteDebuggerCommand( 263 void WebDevToolsAgent::ExecuteDebuggerCommand(
253 const std::string& command, 264 const std::string& command,
254 int caller_id) { 265 int caller_id) {
255 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); 266 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id);
256 } 267 }
257 268
258 // static 269 // static
259 void WebDevToolsAgent::SetMessageLoopDispatchHandler( 270 void WebDevToolsAgent::SetMessageLoopDispatchHandler(
260 MessageLoopDispatchHandler handler) { 271 MessageLoopDispatchHandler handler) {
261 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); 272 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler);
262 } 273 }
274
OLDNEW
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.h ('k') | webkit/webkit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698