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

Side by Side Diff: base/sequence_checker_unittest.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. Created 5 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
« no previous file with comments | « base/prefs/pref_service_factory.cc ('k') | base/single_thread_task_runner.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/sequence_checker.h" 12 #include "base/sequence_checker.h"
13 #include "base/single_thread_task_runner.h"
14 #include "base/test/sequenced_worker_pool_owner.h" 14 #include "base/test/sequenced_worker_pool_owner.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 // Duplicated from base/sequence_checker.h so that we can be good citizens 18 // Duplicated from base/sequence_checker.h so that we can be good citizens
19 // there and undef the macro. 19 // there and undef the macro.
20 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) 20 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON))
21 #define ENABLE_SEQUENCE_CHECKER 1 21 #define ENABLE_SEQUENCE_CHECKER 1
22 #else 22 #else
23 #define ENABLE_SEQUENCE_CHECKER 0 23 #define ENABLE_SEQUENCE_CHECKER 0
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const std::string& token_name) { 77 const std::string& token_name) {
78 pool()->PostNamedSequencedWorkerTask( 78 pool()->PostNamedSequencedWorkerTask(
79 token_name, 79 token_name,
80 FROM_HERE, 80 FROM_HERE,
81 base::Bind(&SequenceCheckedObject::DoStuff, 81 base::Bind(&SequenceCheckedObject::DoStuff,
82 base::Unretained(sequence_checked_object))); 82 base::Unretained(sequence_checked_object)));
83 } 83 }
84 84
85 void PostDoStuffToOtherThread( 85 void PostDoStuffToOtherThread(
86 SequenceCheckedObject* sequence_checked_object) { 86 SequenceCheckedObject* sequence_checked_object) {
87 other_thread()->message_loop()->PostTask( 87 other_thread()->task_runner()->PostTask(
88 FROM_HERE, 88 FROM_HERE, base::Bind(&SequenceCheckedObject::DoStuff,
89 base::Bind(&SequenceCheckedObject::DoStuff, 89 base::Unretained(sequence_checked_object)));
90 base::Unretained(sequence_checked_object)));
91 } 90 }
92 91
93 void PostDeleteToOtherThread( 92 void PostDeleteToOtherThread(
94 scoped_ptr<SequenceCheckedObject> sequence_checked_object) { 93 scoped_ptr<SequenceCheckedObject> sequence_checked_object) {
95 other_thread()->message_loop()->DeleteSoon( 94 other_thread()->message_loop()->DeleteSoon(
96 FROM_HERE, 95 FROM_HERE,
97 sequence_checked_object.release()); 96 sequence_checked_object.release());
98 } 97 }
99 98
100 // Destroys the SequencedWorkerPool instance, blocking until it is fully shut 99 // Destroys the SequencedWorkerPool instance, blocking until it is fully shut
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 #endif // ENABLE_SEQUENCE_CHECKER 324 #endif // ENABLE_SEQUENCE_CHECKER
326 325
327 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_SEQUENCE_CHECKER 326 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_SEQUENCE_CHECKER
328 327
329 } // namespace 328 } // namespace
330 329
331 } // namespace base 330 } // namespace base
332 331
333 // Just in case we ever get lumped together with other compilation units. 332 // Just in case we ever get lumped together with other compilation units.
334 #undef ENABLE_SEQUENCE_CHECKER 333 #undef ENABLE_SEQUENCE_CHECKER
OLDNEW
« no previous file with comments | « base/prefs/pref_service_factory.cc ('k') | base/single_thread_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698