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

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

Issue 11961021: base: Convert scoped_arrays to the new scoped_ptr style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert callback changes Created 7 years, 11 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 // Multi-threaded tests of ConditionVariable class. 5 // Multi-threaded tests of ConditionVariable class.
6 6
7 #include <time.h> 7 #include <time.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Both worker threads and controller use the following to synchronize. 122 // Both worker threads and controller use the following to synchronize.
123 Lock lock_; 123 Lock lock_;
124 ConditionVariable work_is_available_; // To tell threads there is work. 124 ConditionVariable work_is_available_; // To tell threads there is work.
125 125
126 // Conditions to notify the controlling process (if it is interested). 126 // Conditions to notify the controlling process (if it is interested).
127 ConditionVariable all_threads_have_ids_; // All threads are running. 127 ConditionVariable all_threads_have_ids_; // All threads are running.
128 ConditionVariable no_more_tasks_; // Task count is zero. 128 ConditionVariable no_more_tasks_; // Task count is zero.
129 129
130 const int thread_count_; 130 const int thread_count_;
131 int waiting_thread_count_; 131 int waiting_thread_count_;
132 scoped_array<PlatformThreadHandle> thread_handles_; 132 scoped_ptr<PlatformThreadHandle[]> thread_handles_;
133 std::vector<int> assignment_history_; // Number of assignment per worker. 133 std::vector<int> assignment_history_; // Number of assignment per worker.
134 std::vector<int> completion_history_; // Number of completions per worker. 134 std::vector<int> completion_history_; // Number of completions per worker.
135 int thread_started_counter_; // Used to issue unique id to workers. 135 int thread_started_counter_; // Used to issue unique id to workers.
136 int shutdown_task_count_; // Number of tasks told to shutdown 136 int shutdown_task_count_; // Number of tasks told to shutdown
137 int task_count_; // Number of assignment tasks waiting to be processed. 137 int task_count_; // Number of assignment tasks waiting to be processed.
138 TimeDelta worker_delay_; // Time each task takes to complete. 138 TimeDelta worker_delay_; // Time each task takes to complete.
139 bool allow_help_requests_; // Workers can signal more workers. 139 bool allow_help_requests_; // Workers can signal more workers.
140 bool shutdown_; // Set when threads need to terminate. 140 bool shutdown_; // Set when threads need to terminate.
141 141
142 DFAKE_MUTEX(locked_methods_); 142 DFAKE_MUTEX(locked_methods_);
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 base::AutoLock auto_lock(lock_); 706 base::AutoLock auto_lock(lock_);
707 // Send notification that we completed our "work." 707 // Send notification that we completed our "work."
708 WorkIsCompleted(thread_id); 708 WorkIsCompleted(thread_id);
709 } 709 }
710 } 710 }
711 } 711 }
712 712
713 } // namespace 713 } // namespace
714 714
715 } // namespace base 715 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698