summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 09:59:12 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 09:59:12 +0000
commitb20e467a174eb44c19b0ca747dcba1a66aefa5d4 (patch)
treefd394cc48196f21ca830c1787cacbaccc9735300 /webkit
parent44bbfd8d22cf61e7865f53c2ee9c19ad11c01f65 (diff)
downloadchromium_src-b20e467a174eb44c19b0ca747dcba1a66aefa5d4.zip
chromium_src-b20e467a174eb44c19b0ca747dcba1a66aefa5d4.tar.gz
chromium_src-b20e467a174eb44c19b0ca747dcba1a66aefa5d4.tar.bz2
Merge WebKit console and load deferrer changes.
Review URL: http://codereview.chromium.org/99121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/build/WebCore/WebCore.vcproj8
-rw-r--r--webkit/glue/chrome_client_impl.cc7
-rw-r--r--webkit/glue/chrome_client_impl.h3
-rw-r--r--webkit/glue/devtools/debugger_agent_impl.cc51
-rw-r--r--webkit/glue/devtools/js/devtools.js10
-rw-r--r--webkit/glue/devtools/tools_agent.h3
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc36
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h24
-rw-r--r--webkit/webkit.gyp2
9 files changed, 70 insertions, 74 deletions
diff --git a/webkit/build/WebCore/WebCore.vcproj b/webkit/build/WebCore/WebCore.vcproj
index 3f55e32..30a532c 100644
--- a/webkit/build/WebCore/WebCore.vcproj
+++ b/webkit/build/WebCore/WebCore.vcproj
@@ -465,6 +465,14 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\page\PageGroupLoadDeferrer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\page\PageGroupLoadDeferrer.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebCore\page\PositionCallback.h"
>
</File>
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index 40acbcc..573a3b2 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
+#include "Console.h"
#include "Cursor.h"
#include "FloatRect.h"
#include "FileChooser.h"
@@ -272,7 +273,9 @@ void ChromeClientImpl::setResizable(bool value) {
resizable_ = value;
}
-void ChromeClientImpl::addMessageToConsole(const WebCore::String& message,
+void ChromeClientImpl::addMessageToConsole(WebCore::MessageSource source,
+ WebCore::MessageLevel level,
+ const WebCore::String& message,
unsigned int line_no,
const WebCore::String& source_id) {
WebViewDelegate* delegate = webview_->delegate();
@@ -284,7 +287,7 @@ void ChromeClientImpl::addMessageToConsole(const WebCore::String& message,
}
WebDevToolsAgentImpl* devtools_agent = webview_->GetWebDevToolsAgentImpl();
if (devtools_agent) {
- devtools_agent->AddMessageToConsole(message, source_id, line_no);
+ devtools_agent->AddMessageToConsole(source, level, message, line_no, source_id);
}
}
diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h
index 1c69413..a2537fb 100644
--- a/webkit/glue/chrome_client_impl.h
+++ b/webkit/glue/chrome_client_impl.h
@@ -65,7 +65,8 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium {
virtual void setResizable(bool);
- virtual void addMessageToConsole(const WebCore::String& message,
+ virtual void addMessageToConsole(WebCore::MessageSource source,
+ WebCore::MessageLevel level, const WebCore::String& message,
unsigned int lineNumber,
const WebCore::String& sourceID);
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc
index 654bd13c..93b1e6e 100644
--- a/webkit/glue/devtools/debugger_agent_impl.cc
+++ b/webkit/glue/devtools/debugger_agent_impl.cc
@@ -9,10 +9,9 @@
#include <wtf/Vector.h>
#include "Document.h"
-#include "Frame.h"
#include "Node.h"
#include "Page.h"
-#include "PageGroup.h"
+#include "PageGroupLoadDeferrer.h"
#undef LOG
#include "grit/webkit_resources.h"
@@ -29,10 +28,9 @@
using WebCore::DOMWindow;
using WebCore::Document;
-using WebCore::Frame;
using WebCore::Node;
using WebCore::Page;
-using WebCore::PageGroup;
+using WebCore::PageGroupLoadDeferrer;
using WebCore::String;
using WebCore::V8ClassIndex;
using WebCore::V8Custom;
@@ -144,59 +142,24 @@ String DebuggerAgentImpl::ExecuteUtilityFunction(
void DebuggerAgentImpl::RunWithDeferredMessages(
const HashSet<DebuggerAgentImpl*>& agents,
WebDevToolsAgent::MessageLoopDispatchHandler handler) {
-
- // TODO(pfeldman): Make PageGroupLoadDeferrer visible and use it from here.
- // Code below is derived from the Chrome.cpp's PageGroupLoadDeferrer:
+ Vector<PageGroupLoadDeferrer*> deferrers;
// 1. Disable active objects and input events.
- Vector<RefPtr<Frame>, 16> deferred_frames;
for (HashSet<DebuggerAgentImpl*>::const_iterator ag_it = agents.begin();
ag_it != agents.end(); ++ag_it) {
DebuggerAgentImpl* agent = *ag_it;
+ deferrers.append(new PageGroupLoadDeferrer(agent->GetPage(), true));
agent->web_view()->SetIgnoreInputEvents(true);
- const HashSet<Page*>& pages = agent->GetPage()->group().pages();
- HashSet<Page*>::const_iterator end = pages.end();
- for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
- Page* other_page = *it;
- if (!other_page->defersLoading()) {
- deferred_frames.append(other_page->mainFrame());
-#if !PLATFORM(MAC)
- for (Frame* frame = other_page->mainFrame(); frame;
- frame = frame->tree()->traverseNext()) {
- frame->document()->suspendActiveDOMObjects();
- }
-#endif
- }
- }
}
- // 2. Disable loading.
- size_t count = deferred_frames.size();
- for (size_t i = 0; i < count; ++i) {
- if (Page* page = deferred_frames[i]->page()) {
- page->setDefersLoading(true);
- }
- }
- // 3. Process messages.
+ // 2. Process messages.
handler();
- // 4. Bring things back.
- for (size_t i = 0; i < deferred_frames.size(); ++i) {
- if (Page* page = deferred_frames[i]->page()) {
- page->setDefersLoading(false);
-
-#if !PLATFORM(MAC)
- for (Frame* frame = page->mainFrame(); frame; frame =
- frame->tree()->traverseNext()) {
- frame->document()->resumeActiveDOMObjects();
- }
-#endif
- }
- }
-
+ // 3. Bring things back.
for (HashSet<DebuggerAgentImpl*>::const_iterator ag_it = agents.begin();
ag_it != agents.end(); ++ag_it) {
(*ag_it)->web_view()->SetIgnoreInputEvents(false);
}
+ deleteAllValues(deferrers);
}
WebCore::Page* DebuggerAgentImpl::GetPage() {
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 79ebf41..f263962 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -102,17 +102,15 @@ devtools.ToolsAgent.prototype.frameNavigate = function(url, topLevel) {
/**
- * @param {string} message Message to add.
- * @param {string} source Source url.
- * @param {number} line Line number in source.
+ * @param {Object} message Message object to add.
* @see tools_agent.h
*/
-devtools.ToolsAgent.prototype.addMessageToConsole = function(message, source,
- line) {
+devtools.ToolsAgent.prototype.addMessageToConsole = function(message) {
var console = WebInspector.console;
if (console) {
console.addMessage(new WebInspector.ConsoleMessage(
- '', undefined, line, source, undefined, 1, message));
+ message.source, message.level, message.line, message.sourceId,
+ undefined, 1, message.text));
}
};
diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h
index d98559e..2ff584e 100644
--- a/webkit/glue/devtools/tools_agent.h
+++ b/webkit/glue/devtools/tools_agent.h
@@ -44,8 +44,7 @@ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT)
METHOD2(DidExecuteUtilityFunction, int /* call_id */, String /* json */) \
\
/* Adds message to console. */ \
- METHOD3(AddMessageToConsole, String /* message */, \
- String /* source_id */, int /* line_no */)
+ METHOD1(AddMessageToConsole, Value /* message */)
DEFINE_RPC_CLASS(ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT)
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index 769a477..0e4079e 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -81,10 +81,9 @@ void WebDevToolsAgentImpl::Attach() {
// Populate console.
for (Vector<ConsoleMessage>::iterator it = console_log_.begin();
it != console_log_.end(); ++it) {
- tools_agent_delegate_stub_->AddMessageToConsole(
- it->message,
- it->source_id,
- it->line_no);
+ DictionaryValue message;
+ Serialize(*it, &message);
+ tools_agent_delegate_stub_->AddMessageToConsole(message);
}
net_agent_impl_->Attach();
@@ -137,20 +136,21 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
}
void WebDevToolsAgentImpl::AddMessageToConsole(
- const String& message,
- const String& source_id,
- unsigned int line_no) {
- ConsoleMessage cm(message, source_id, line_no);
+ int source,
+ int level,
+ const String& text,
+ unsigned int line_no,
+ const String& source_id) {
+ ConsoleMessage cm(source, level, text, line_no, source_id);
console_log_.append(cm);
if (console_log_.size() >= kMaxConsoleMessages) {
// Batch shifts to save ticks.
console_log_.remove(0, kMaxConsoleMessages / 5);
}
if (attached_) {
- tools_agent_delegate_stub_->AddMessageToConsole(
- message,
- source_id,
- line_no);
+ DictionaryValue message;
+ Serialize(cm, &message);
+ tools_agent_delegate_stub_->AddMessageToConsole(message);
}
}
@@ -249,6 +249,17 @@ void WebDevToolsAgentImpl::SendRpcMessage(const std::string& raw_msg) {
}
// static
+void WebDevToolsAgentImpl::Serialize(const ConsoleMessage& message,
+ DictionaryValue* value) {
+ value->SetInteger(L"source", message.source);
+ value->SetInteger(L"level", message.level);
+ value->SetString(L"text", webkit_glue::StringToStdString(message.text));
+ value->SetString(L"sourceId",
+ webkit_glue::StringToStdString(message.source_id));
+ value->SetInteger(L"line", message.line_no);
+}
+
+// static
void WebDevToolsAgent::ExecuteDebuggerCommand(
const std::string& command,
int caller_id) {
@@ -260,3 +271,4 @@ void WebDevToolsAgent::SetMessageLoopDispatchHandler(
MessageLoopDispatchHandler handler) {
DebuggerAgentManager::SetMessageLoopDispatchHandler(handler);
}
+
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index 4a3c9ea..a966e28 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -67,9 +67,11 @@ class WebDevToolsAgentImpl
WebFrame* frame,
bool is_new_navigation);
void AddMessageToConsole(
+ int source,
+ int level,
const WebCore::String& message,
- const WebCore::String& source_id,
- unsigned int line_no);
+ unsigned int line_no,
+ const WebCore::String& source_id);
void ForceRepaint();
@@ -78,15 +80,23 @@ class WebDevToolsAgentImpl
private:
struct ConsoleMessage {
- ConsoleMessage(const String& m, const String& sid, unsigned li)
- : message(m),
- source_id(sid),
- line_no(li) {
+ ConsoleMessage(
+ int src, int lvl, const String& m, unsigned li, const String& sid)
+ : source(src),
+ level(lvl),
+ text(m),
+ line_no(li),
+ source_id(sid) {
}
- WebCore::String message;
+ int source;
+ int level;
+ WebCore::String text;
WebCore::String source_id;
unsigned int line_no;
};
+
+ static void Serialize(const ConsoleMessage& message, DictionaryValue* value);
+
int host_id_;
WebDevToolsAgentDelegate* delegate_;
WebViewImpl* web_view_impl_;
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 1ea30417..92a5adf 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -2025,6 +2025,8 @@
'../third_party/WebKit/WebCore/page/Page.h',
'../third_party/WebKit/WebCore/page/PageGroup.cpp',
'../third_party/WebKit/WebCore/page/PageGroup.h',
+ '../third_party/WebKit/WebCore/page/PageGroupLoadDeferrer.cpp',
+ '../third_party/WebKit/WebCore/page/PageGroupLoadDeferrer.h',
'../third_party/WebKit/WebCore/page/PositionCallback.h',
'../third_party/WebKit/WebCore/page/PositionError.h',
'../third_party/WebKit/WebCore/page/PositionErrorCallback.h',