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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 1037933002: [DevTools] Send ServiceWorkerVersion.ScriptLastModified and ScriptResponseTime to DevTools window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test failure Created 5 years, 8 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
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "content/public/browser/content_browser_client.h" 27 #include "content/public/browser/content_browser_client.h"
28 #include "content/public/browser/page_navigator.h" 28 #include "content/public/browser/page_navigator.h"
29 #include "content/public/browser/render_frame_host.h" 29 #include "content/public/browser/render_frame_host.h"
30 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
32 #include "content/public/browser/web_contents_observer.h" 32 #include "content/public/browser/web_contents_observer.h"
33 #include "content/public/common/child_process_host.h" 33 #include "content/public/common/child_process_host.h"
34 #include "content/public/common/content_client.h" 34 #include "content/public/common/content_client.h"
35 #include "content/public/common/content_switches.h" 35 #include "content/public/common/content_switches.h"
36 #include "content/public/common/result_codes.h" 36 #include "content/public/common/result_codes.h"
37 #include "net/http/http_response_headers.h"
37 #include "net/http/http_response_info.h" 38 #include "net/http/http_response_info.h"
38 39
39 namespace content { 40 namespace content {
40 41
41 using StatusCallback = ServiceWorkerVersion::StatusCallback; 42 using StatusCallback = ServiceWorkerVersion::StatusCallback;
42 using GetClientsCallback = 43 using GetClientsCallback =
43 base::Callback<void(const std::vector<ServiceWorkerClientInfo>&)>; 44 base::Callback<void(const std::vector<ServiceWorkerClientInfo>&)>;
44 45
45 namespace { 46 namespace {
46 47
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 FOR_EACH_OBSERVER(Listener, listeners_, OnVersionStateChanged(this)); 380 FOR_EACH_OBSERVER(Listener, listeners_, OnVersionStateChanged(this));
380 } 381 }
381 382
382 void ServiceWorkerVersion::RegisterStatusChangeCallback( 383 void ServiceWorkerVersion::RegisterStatusChangeCallback(
383 const base::Closure& callback) { 384 const base::Closure& callback) {
384 status_change_callbacks_.push_back(callback); 385 status_change_callbacks_.push_back(callback);
385 } 386 }
386 387
387 ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() { 388 ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() {
388 DCHECK_CURRENTLY_ON(BrowserThread::IO); 389 DCHECK_CURRENTLY_ON(BrowserThread::IO);
389 return ServiceWorkerVersionInfo( 390 ServiceWorkerVersionInfo info(
390 running_status(), status(), script_url(), registration_id(), version_id(), 391 running_status(), status(), script_url(), registration_id(), version_id(),
391 embedded_worker()->process_id(), embedded_worker()->thread_id(), 392 embedded_worker()->process_id(), embedded_worker()->thread_id(),
392 embedded_worker()->worker_devtools_agent_route_id()); 393 embedded_worker()->worker_devtools_agent_route_id());
394 if (!main_script_http_info_)
395 return info;
396 info.script_response_time = main_script_http_info_->response_time;
397 if (main_script_http_info_->headers)
398 main_script_http_info_->headers->GetLastModifiedValue(
399 &info.script_last_modified);
400 return info;
393 } 401 }
394 402
395 void ServiceWorkerVersion::StartWorker(const StatusCallback& callback) { 403 void ServiceWorkerVersion::StartWorker(const StatusCallback& callback) {
396 StartWorker(false, callback); 404 StartWorker(false, callback);
397 } 405 }
398 406
399 void ServiceWorkerVersion::StartWorker( 407 void ServiceWorkerVersion::StartWorker(
400 bool pause_after_download, 408 bool pause_after_download,
401 const StatusCallback& callback) { 409 const StatusCallback& callback) {
402 if (!context_) { 410 if (!context_) {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 RestartTick(&start_time_); 833 RestartTick(&start_time_);
826 } 834 }
827 835
828 // Reactivate request timeouts. 836 // Reactivate request timeouts.
829 SetAllRequestTimes(base::TimeTicks::Now()); 837 SetAllRequestTimes(base::TimeTicks::Now());
830 } 838 }
831 839
832 void ServiceWorkerVersion::SetMainScriptHttpResponseInfo( 840 void ServiceWorkerVersion::SetMainScriptHttpResponseInfo(
833 const net::HttpResponseInfo& http_info) { 841 const net::HttpResponseInfo& http_info) {
834 main_script_http_info_.reset(new net::HttpResponseInfo(http_info)); 842 main_script_http_info_.reset(new net::HttpResponseInfo(http_info));
843 FOR_EACH_OBSERVER(Listener, listeners_,
844 OnMainScriptHttpResponseInfoSet(this));
835 } 845 }
836 846
837 const net::HttpResponseInfo* 847 const net::HttpResponseInfo*
838 ServiceWorkerVersion::GetMainScriptHttpResponseInfo() { 848 ServiceWorkerVersion::GetMainScriptHttpResponseInfo() {
839 return main_script_http_info_.get(); 849 return main_script_http_info_.get();
840 } 850 }
841 851
842 ServiceWorkerVersion::RequestInfo::RequestInfo(int id, RequestType type) 852 ServiceWorkerVersion::RequestInfo::RequestInfo(int id, RequestType type)
843 : id(id), type(type), time(base::TimeTicks::Now()) { 853 : id(id), type(type), time(base::TimeTicks::Now()) {
844 } 854 }
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 while (!requests_.empty()) { 1771 while (!requests_.empty()) {
1762 RequestInfo info = requests_.front(); 1772 RequestInfo info = requests_.front();
1763 info.time = ticks; 1773 info.time = ticks;
1764 new_requests.push(info); 1774 new_requests.push(info);
1765 requests_.pop(); 1775 requests_.pop();
1766 } 1776 }
1767 requests_ = new_requests; 1777 requests_ = new_requests;
1768 } 1778 }
1769 1779
1770 } // namespace content 1780 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698