OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tracked_objects.h" | 5 #include "base/tracked_objects.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (current() != it && it->message_loop()) | 345 if (current() != it && it->message_loop()) |
346 message_loops.push_back(it->message_loop()); | 346 message_loops.push_back(it->message_loop()); |
347 } | 347 } |
348 | 348 |
349 ThreadSafeDownCounter* counter = | 349 ThreadSafeDownCounter* counter = |
350 new ThreadSafeDownCounter(message_loops.size() + 1); // Extra one for us! | 350 new ThreadSafeDownCounter(message_loops.size() + 1); // Extra one for us! |
351 | 351 |
352 HANDLE completion_handle = CreateEvent(NULL, false, false, NULL); | 352 HANDLE completion_handle = CreateEvent(NULL, false, false, NULL); |
353 // Tell all other threads to run. | 353 // Tell all other threads to run. |
354 for (size_t i = 0; i < message_loops.size(); ++i) | 354 for (size_t i = 0; i < message_loops.size(); ++i) |
355 message_loops[i]->PostTask(FROM_HERE, | 355 message_loops[i]->PostTask( |
356 new RunTheStatic(function, completion_handle, counter)); | 356 FROM_HERE, new RunTheStatic(function, completion_handle, counter)); |
357 | 357 |
358 // Also run Task on our thread. | 358 // Also run Task on our thread. |
359 RunTheStatic local_task(function, completion_handle, counter); | 359 RunTheStatic local_task(function, completion_handle, counter); |
360 local_task.Run(); | 360 local_task.Run(); |
361 | 361 |
362 WaitForSingleObject(completion_handle, INFINITE); | 362 WaitForSingleObject(completion_handle, INFINITE); |
363 int ret_val = CloseHandle(completion_handle); | 363 int ret_val = CloseHandle(completion_handle); |
364 DCHECK(ret_val); | 364 DCHECK(ret_val); |
365 } | 365 } |
366 #endif | 366 #endif |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 (combined_selectors_ & BIRTH_THREAD) ? "*" : | 980 (combined_selectors_ & BIRTH_THREAD) ? "*" : |
981 sample.birth().birth_thread()->ThreadName().c_str(), | 981 sample.birth().birth_thread()->ThreadName().c_str(), |
982 (combined_selectors_ & DEATH_THREAD) ? "*" : | 982 (combined_selectors_ & DEATH_THREAD) ? "*" : |
983 sample.DeathThreadName().c_str()); | 983 sample.DeathThreadName().c_str()); |
984 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), | 984 sample.birth().location().Write(!(combined_selectors_ & BIRTH_FILE), |
985 !(combined_selectors_ & BIRTH_FUNCTION), | 985 !(combined_selectors_ & BIRTH_FUNCTION), |
986 output); | 986 output); |
987 } | 987 } |
988 | 988 |
989 } // namespace tracked_objects | 989 } // namespace tracked_objects |
OLD | NEW |