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

Side by Side Diff: net/disk_cache/blockfile/in_flight_io.cc

Issue 650483003: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « net/disk_cache/blockfile/in_flight_backend_io.cc ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/disk_cache/blockfile/in_flight_io.h" 5 #include "net/disk_cache/blockfile/in_flight_io.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/profiler/scoped_profile.h"
10 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
11 #include "base/task_runner.h" 12 #include "base/task_runner.h"
12 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
13 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
14 15
15 namespace disk_cache { 16 namespace disk_cache {
16 17
17 BackgroundIO::BackgroundIO(InFlightIO* controller) 18 BackgroundIO::BackgroundIO(InFlightIO* controller)
18 : result_(-1), io_completed_(true, false), controller_(controller) { 19 : result_(-1), io_completed_(true, false), controller_(controller) {
19 } 20 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #endif 81 #endif
81 82
82 callback_task_runner_->PostTask( 83 callback_task_runner_->PostTask(
83 FROM_HERE, base::Bind(&BackgroundIO::OnIOSignalled, operation)); 84 FROM_HERE, base::Bind(&BackgroundIO::OnIOSignalled, operation));
84 operation->io_completed()->Signal(); 85 operation->io_completed()->Signal();
85 } 86 }
86 87
87 // Runs on the primary thread. 88 // Runs on the primary thread.
88 void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) { 89 void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) {
89 { 90 {
91 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed.
92 tracked_objects::ScopedProfile tracking_profile(
93 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 InFlightIO::InvokeCallback"));
94
90 // http://crbug.com/74623 95 // http://crbug.com/74623
91 base::ThreadRestrictions::ScopedAllowWait allow_wait; 96 base::ThreadRestrictions::ScopedAllowWait allow_wait;
92 operation->io_completed()->Wait(); 97 operation->io_completed()->Wait();
93 } 98 }
94 running_ = true; 99 running_ = true;
95 100
96 if (cancel_task) 101 if (cancel_task)
97 operation->Cancel(); 102 operation->Cancel();
98 103
99 // Make sure that we remove the operation from the list before invoking the 104 // Make sure that we remove the operation from the list before invoking the
100 // callback (so that a subsequent cancel does not invoke the callback again). 105 // callback (so that a subsequent cancel does not invoke the callback again).
101 DCHECK(io_list_.find(operation) != io_list_.end()); 106 DCHECK(io_list_.find(operation) != io_list_.end());
102 DCHECK(!operation->HasOneRef()); 107 DCHECK(!operation->HasOneRef());
103 io_list_.erase(make_scoped_refptr(operation)); 108 io_list_.erase(make_scoped_refptr(operation));
104 OnOperationComplete(operation, cancel_task); 109 OnOperationComplete(operation, cancel_task);
105 } 110 }
106 111
107 // Runs on the primary thread. 112 // Runs on the primary thread.
108 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 113 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
109 DCHECK(callback_task_runner_->RunsTasksOnCurrentThread()); 114 DCHECK(callback_task_runner_->RunsTasksOnCurrentThread());
110 io_list_.insert(make_scoped_refptr(operation)); 115 io_list_.insert(make_scoped_refptr(operation));
111 } 116 }
112 117
113 } // namespace disk_cache 118 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/in_flight_backend_io.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698