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

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

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

Powered by Google App Engine
This is Rietveld 408576698