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

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

Issue 732633002: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ comments Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_cache.h" 5 #include "content/browser/service_worker/service_worker_cache.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/profiler/scoped_tracker.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "content/browser/service_worker/service_worker_cache.pb.h" 14 #include "content/browser/service_worker/service_worker_cache.pb.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
17 #include "net/disk_cache/disk_cache.h" 18 #include "net/disk_cache/disk_cache.h"
18 #include "net/url_request/url_request_context.h" 19 #include "net/url_request/url_request_context.h"
19 #include "storage/browser/blob/blob_data_handle.h" 20 #include "storage/browser/blob/blob_data_handle.h"
20 #include "storage/browser/blob/blob_storage_context.h" 21 #include "storage/browser/blob/blob_storage_context.h"
21 #include "storage/browser/blob/blob_url_request_job_factory.h" 22 #include "storage/browser/blob/blob_url_request_job_factory.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void OnSSLCertificateError(net::URLRequest* request, 440 void OnSSLCertificateError(net::URLRequest* request,
440 const net::SSLInfo& ssl_info, 441 const net::SSLInfo& ssl_info,
441 bool fatal) override { 442 bool fatal) override {
442 NOTREACHED(); 443 NOTREACHED();
443 } 444 }
444 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override { 445 void OnBeforeNetworkStart(net::URLRequest* request, bool* defer) override {
445 NOTREACHED(); 446 NOTREACHED();
446 } 447 }
447 448
448 void OnResponseStarted(net::URLRequest* request) override { 449 void OnResponseStarted(net::URLRequest* request) override {
450 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
451 tracked_objects::ScopedTracker tracking_profile(
452 FROM_HERE_WITH_EXPLICIT_FUNCTION(
453 "423948 ServiceWorkerCache::BlobReader::OnResponseStarted"));
454
449 if (!request->status().is_success()) { 455 if (!request->status().is_success()) {
450 callback_.Run(entry_.Pass(), false); 456 callback_.Run(entry_.Pass(), false);
451 return; 457 return;
452 } 458 }
453 ReadFromBlob(); 459 ReadFromBlob();
454 } 460 }
455 461
456 virtual void ReadFromBlob() { 462 virtual void ReadFromBlob() {
457 int bytes_read = 0; 463 int bytes_read = 0;
458 bool done = 464 bool done =
459 blob_request_->Read(buffer_.get(), buffer_->size(), &bytes_read); 465 blob_request_->Read(buffer_.get(), buffer_->size(), &bytes_read);
460 if (done) 466 if (done)
461 OnReadCompleted(blob_request_.get(), bytes_read); 467 OnReadCompleted(blob_request_.get(), bytes_read);
462 } 468 }
463 469
464 void OnReadCompleted(net::URLRequest* request, int bytes_read) override { 470 void OnReadCompleted(net::URLRequest* request, int bytes_read) override {
471 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
472 tracked_objects::ScopedTracker tracking_profile(
473 FROM_HERE_WITH_EXPLICIT_FUNCTION(
474 "423948 ServiceWorkerCache::BlobReader::OnReadCompleted"));
475
465 if (!request->status().is_success()) { 476 if (!request->status().is_success()) {
466 callback_.Run(entry_.Pass(), false); 477 callback_.Run(entry_.Pass(), false);
467 return; 478 return;
468 } 479 }
469 480
470 if (bytes_read == 0) { 481 if (bytes_read == 0) {
471 callback_.Run(entry_.Pass(), true); 482 callback_.Run(entry_.Pass(), true);
472 return; 483 return;
473 } 484 }
474 485
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 1250
1240 void ServiceWorkerCache::PendingRequestsCallback( 1251 void ServiceWorkerCache::PendingRequestsCallback(
1241 const RequestsCallback& callback, 1252 const RequestsCallback& callback,
1242 ErrorType error, 1253 ErrorType error,
1243 scoped_ptr<Requests> requests) { 1254 scoped_ptr<Requests> requests) {
1244 callback.Run(error, requests.Pass()); 1255 callback.Run(error, requests.Pass());
1245 DecPendingOps(); 1256 DecPendingOps();
1246 } 1257 }
1247 1258
1248 } // namespace content 1259 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader.cc ('k') | content/browser/service_worker/service_worker_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698