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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 17 matching lines...) Expand all
28 controller_ = NULL; 28 controller_ = NULL;
29 } 29 }
30 30
31 BackgroundIO::~BackgroundIO() { 31 BackgroundIO::~BackgroundIO() {
32 } 32 }
33 33
34 // --------------------------------------------------------------------------- 34 // ---------------------------------------------------------------------------
35 35
36 InFlightIO::InFlightIO() 36 InFlightIO::InFlightIO()
37 : callback_thread_(base::MessageLoopProxy::current()), 37 : callback_thread_(base::MessageLoopProxy::current()),
38 running_(false), single_thread_(false) { 38 running_(false),
39 single_thread_(false) {
39 } 40 }
40 41
41 InFlightIO::~InFlightIO() { 42 InFlightIO::~InFlightIO() {
42 } 43 }
43 44
44 // Runs on the background thread. 45 // Runs on the background thread.
45 void BackgroundIO::NotifyController() { 46 void BackgroundIO::NotifyController() {
46 base::AutoLock lock(controller_lock_); 47 base::AutoLock lock(controller_lock_);
47 if (controller_) 48 if (controller_)
48 controller_->OnIOComplete(this); 49 controller_->OnIOComplete(this);
(...skipping 19 matching lines...) Expand all
68 69
69 // Runs on a background thread. 70 // Runs on a background thread.
70 void InFlightIO::OnIOComplete(BackgroundIO* operation) { 71 void InFlightIO::OnIOComplete(BackgroundIO* operation) {
71 #ifndef NDEBUG 72 #ifndef NDEBUG
72 if (callback_thread_->BelongsToCurrentThread()) { 73 if (callback_thread_->BelongsToCurrentThread()) {
73 DCHECK(single_thread_ || !running_); 74 DCHECK(single_thread_ || !running_);
74 single_thread_ = true; 75 single_thread_ = true;
75 } 76 }
76 #endif 77 #endif
77 78
78 callback_thread_->PostTask(FROM_HERE, 79 callback_thread_->PostTask(
79 base::Bind(&BackgroundIO::OnIOSignalled, 80 FROM_HERE, base::Bind(&BackgroundIO::OnIOSignalled, operation));
80 operation));
81 operation->io_completed()->Signal(); 81 operation->io_completed()->Signal();
82 } 82 }
83 83
84 // Runs on the primary thread. 84 // Runs on the primary thread.
85 void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) { 85 void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) {
86 { 86 {
87 // http://crbug.com/74623 87 // http://crbug.com/74623
88 base::ThreadRestrictions::ScopedAllowWait allow_wait; 88 base::ThreadRestrictions::ScopedAllowWait allow_wait;
89 operation->io_completed()->Wait(); 89 operation->io_completed()->Wait();
90 } 90 }
(...skipping 10 matching lines...) Expand all
101 OnOperationComplete(operation, cancel_task); 101 OnOperationComplete(operation, cancel_task);
102 } 102 }
103 103
104 // Runs on the primary thread. 104 // Runs on the primary thread.
105 void InFlightIO::OnOperationPosted(BackgroundIO* operation) { 105 void InFlightIO::OnOperationPosted(BackgroundIO* operation) {
106 DCHECK(callback_thread_->BelongsToCurrentThread()); 106 DCHECK(callback_thread_->BelongsToCurrentThread());
107 io_list_.insert(make_scoped_refptr(operation)); 107 io_list_.insert(make_scoped_refptr(operation));
108 } 108 }
109 109
110 } // namespace disk_cache 110 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698