diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 09:51:50 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 09:51:50 +0000 |
commit | 460ebed4905c49da8d13cb07fd1b971efa647b40 (patch) | |
tree | 51028b911f8e9bf6384c2b0361c12e1d50457a20 /webkit | |
parent | 4a05f3bd3ff179eb52e0a465be60cc45f9cb82c4 (diff) | |
download | chromium_src-460ebed4905c49da8d13cb07fd1b971efa647b40.zip chromium_src-460ebed4905c49da8d13cb07fd1b971efa647b40.tar.gz chromium_src-460ebed4905c49da8d13cb07fd1b971efa647b40.tar.bz2 |
DevTools: Display main resource url as devtools window title.
Review URL: http://codereview.chromium.org/113693
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/js/net_agent.js | 3 | ||||
-rw-r--r-- | webkit/glue/devtools/net_agent_impl.cc | 14 | ||||
-rw-r--r-- | webkit/glue/devtools/net_agent_impl.h | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/webkit/glue/devtools/js/net_agent.js b/webkit/glue/devtools/js/net_agent.js index bf4cd68..957e119 100644 --- a/webkit/glue/devtools/js/net_agent.js +++ b/webkit/glue/devtools/js/net_agent.js @@ -120,4 +120,7 @@ devtools.NetAgent.prototype.didFinishLoading = function(identifier, value) { resource.endTime = value.endTime; resource.finished = true; resource.failed = !!value.errorCode; + if (resource.mainResource) { + document.title = 'Developer Tools - ' + resource.url; + } }; diff --git a/webkit/glue/devtools/net_agent_impl.cc b/webkit/glue/devtools/net_agent_impl.cc index ab3d60b..e1c0e84 100644 --- a/webkit/glue/devtools/net_agent_impl.cc +++ b/webkit/glue/devtools/net_agent_impl.cc @@ -140,16 +140,17 @@ void NetAgentImpl::DidFinishLoading( return; } + Resource* resource = pending_resources_.get(identifier); + resource->end_time = WTF::currentTime(); + // This is the first command being dispatched after // DidCommitMainResourceLoad, we know that the first resource to be reported // as loaded is main resource. if (!main_loader_.get()) { main_loader_ = loader; + resource->main_resource = true; } - Resource* resource = pending_resources_.get(identifier); - resource->end_time = WTF::currentTime(); - pending_resources_.remove(identifier); finished_resources_.append(std::make_pair(identifier, resource)); @@ -303,7 +304,7 @@ void NetAgentImpl::Serialize(const Resource& resource, value->Set(L"responseHeaders", BuildValueForHeaders(resource.response_headers)); - value->SetBoolean(L"isMainResource", false); + value->SetBoolean(L"isMainResource", resource.main_resource); value->SetBoolean(L"cached", false); if (resource.error_code) { @@ -315,9 +316,10 @@ void NetAgentImpl::Serialize(const Resource& resource, void NetAgentImpl::ExpireFinishedResourcesCache() { if (finished_resources_.size() > 100) { - for (int i = 0; i < 20; ++i) { + // Preserve main resource. + for (int i = 1; i < 21; ++i) { delete finished_resources_[i].second; } - finished_resources_.remove(0, 20); + finished_resources_.remove(1, 21); } } diff --git a/webkit/glue/devtools/net_agent_impl.h b/webkit/glue/devtools/net_agent_impl.h index a197ac3..a308167 100644 --- a/webkit/glue/devtools/net_agent_impl.h +++ b/webkit/glue/devtools/net_agent_impl.h @@ -88,13 +88,16 @@ class NetAgentImpl : public NetAgent { private: struct Resource { Resource() - : start_time(0), + : main_resource(false), + start_time(0), response_received_time(0), end_time(0), expected_content_length(0), http_status_code(0), error_code(0) { } + bool main_resource; + double start_time; double response_received_time; double end_time; |