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

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

Issue 2030663002: Migrate WaitableEvent to enum-based constructor in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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/backend_impl.cc ('k') | net/dns/serial_worker_unittest.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/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/task_runner.h" 11 #include "base/task_runner.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 15
16 namespace disk_cache { 16 namespace disk_cache {
17 17
18 BackgroundIO::BackgroundIO(InFlightIO* controller) 18 BackgroundIO::BackgroundIO(InFlightIO* controller)
19 : result_(-1), io_completed_(true, false), controller_(controller) { 19 : result_(-1),
20 } 20 io_completed_(base::WaitableEvent::ResetPolicy::MANUAL,
21 base::WaitableEvent::InitialState::NOT_SIGNALED),
22 controller_(controller) {}
21 23
22 // Runs on the primary thread. 24 // Runs on the primary thread.
23 void BackgroundIO::OnIOSignalled() { 25 void BackgroundIO::OnIOSignalled() {
24 // TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed. 26 // TODO(pkasting): Remove ScopedTracker below once crbug.com/477117 is fixed.
25 tracked_objects::ScopedTracker tracking_profile( 27 tracked_objects::ScopedTracker tracking_profile(
26 FROM_HERE_WITH_EXPLICIT_FUNCTION("477117 BackgroundIO::OnIOSignalled")); 28 FROM_HERE_WITH_EXPLICIT_FUNCTION("477117 BackgroundIO::OnIOSignalled"));
27 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), "BackgroundIO::OnIOSignalled"); 29 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("net"), "BackgroundIO::OnIOSignalled");
28 if (controller_) 30 if (controller_)
29 controller_->InvokeCallback(this, false); 31 controller_->InvokeCallback(this, false);
30 } 32 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 OnOperationComplete(operation, cancel_task); 109 OnOperationComplete(operation, cancel_task);
108 } 110 }
109 111
110 // Runs on the primary thread. 112 // Runs on the primary thread.
111 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 113 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
112 DCHECK(callback_task_runner_->RunsTasksOnCurrentThread()); 114 DCHECK(callback_task_runner_->RunsTasksOnCurrentThread());
113 io_list_.insert(make_scoped_refptr(operation)); 115 io_list_.insert(make_scoped_refptr(operation));
114 } 116 }
115 117
116 } // namespace disk_cache 118 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_impl.cc ('k') | net/dns/serial_worker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698