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

Side by Side Diff: base/synchronization/condition_variable_win.cc

Issue 8368009: Replace most LOG statements with DLOG statements in base. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « base/sync_socket_posix.cc ('k') | base/system_monitor/system_monitor.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/synchronization/condition_variable.h" 5 #include "base/synchronization/condition_variable.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // objects as there are threads simultaneously using this instance's Wait() 110 // objects as there are threads simultaneously using this instance's Wait()
111 // functionality. 111 // functionality.
112 ConditionVariable::Event* ConditionVariable::GetEventForWaiting() { 112 ConditionVariable::Event* ConditionVariable::GetEventForWaiting() {
113 // We hold internal_lock, courtesy of Wait(). 113 // We hold internal_lock, courtesy of Wait().
114 Event* cv_event; 114 Event* cv_event;
115 if (0 == recycling_list_size_) { 115 if (0 == recycling_list_size_) {
116 DCHECK(recycling_list_.IsEmpty()); 116 DCHECK(recycling_list_.IsEmpty());
117 cv_event = new Event(); 117 cv_event = new Event();
118 cv_event->InitListElement(); 118 cv_event->InitListElement();
119 allocation_counter_++; 119 allocation_counter_++;
120 CHECK(cv_event->handle()); 120 DCHECK(cv_event->handle());
121 } else { 121 } else {
122 cv_event = recycling_list_.PopFront(); 122 cv_event = recycling_list_.PopFront();
123 recycling_list_size_--; 123 recycling_list_size_--;
124 } 124 }
125 waiting_list_.PushBack(cv_event); 125 waiting_list_.PushBack(cv_event);
126 return cv_event; 126 return cv_event;
127 } 127 }
128 128
129 // RecycleEvent() takes a cv_event that was previously used for Wait()ing, and 129 // RecycleEvent() takes a cv_event that was previously used for Wait()ing, and
130 // recycles it for use in future Wait() calls for this or other threads. 130 // recycles it for use in future Wait() calls for this or other threads.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (0 != handle_) { 186 if (0 != handle_) {
187 int ret_val = CloseHandle(handle_); 187 int ret_val = CloseHandle(handle_);
188 DCHECK(ret_val); 188 DCHECK(ret_val);
189 } 189 }
190 } 190 }
191 191
192 // Change a container instance permanently into an element of a list. 192 // Change a container instance permanently into an element of a list.
193 void ConditionVariable::Event::InitListElement() { 193 void ConditionVariable::Event::InitListElement() {
194 DCHECK(!handle_); 194 DCHECK(!handle_);
195 handle_ = CreateEvent(NULL, false, false, NULL); 195 handle_ = CreateEvent(NULL, false, false, NULL);
196 CHECK(handle_); 196 DCHECK(handle_);
197 } 197 }
198 198
199 // Methods for use on lists. 199 // Methods for use on lists.
200 bool ConditionVariable::Event::IsEmpty() const { 200 bool ConditionVariable::Event::IsEmpty() const {
201 DCHECK(ValidateAsList()); 201 DCHECK(ValidateAsList());
202 return IsSingleton(); 202 return IsSingleton();
203 } 203 }
204 204
205 void ConditionVariable::Event::PushBack(Event* other) { 205 void ConditionVariable::Event::PushBack(Event* other) {
206 DCHECK(ValidateAsList()); 206 DCHECK(ValidateAsList());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 provided O(1) performance in all required operations. Since other operations 438 provided O(1) performance in all required operations. Since other operations
439 to provide performance-and/or-fairness required queue (FIFO) and list (LIFO) 439 to provide performance-and/or-fairness required queue (FIFO) and list (LIFO)
440 containers, I would also have needed to use an STL list/queue as well as an STL 440 containers, I would also have needed to use an STL list/queue as well as an STL
441 map. In the end I decided it would be "fun" to just do it right, and I 441 map. In the end I decided it would be "fun" to just do it right, and I
442 put so many assertions (DCHECKs) into the container class that it is trivial to 442 put so many assertions (DCHECKs) into the container class that it is trivial to
443 code review and validate its correctness. 443 code review and validate its correctness.
444 444
445 */ 445 */
446 446
447 } // namespace base 447 } // namespace base
OLDNEW
« no previous file with comments | « base/sync_socket_posix.cc ('k') | base/system_monitor/system_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698