| OLD | NEW | 
|    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" | 
|   12 #include "base/sequence_checker.h" |   13 #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  Loading... | 
|   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()->task_runner()->PostTask( |   87     other_thread()->message_loop()->PostTask( | 
|   88         FROM_HERE, base::Bind(&SequenceCheckedObject::DoStuff, |   88         FROM_HERE, | 
|   89                               base::Unretained(sequence_checked_object))); |   89         base::Bind(&SequenceCheckedObject::DoStuff, | 
 |   90                    base::Unretained(sequence_checked_object))); | 
|   90   } |   91   } | 
|   91  |   92  | 
|   92   void PostDeleteToOtherThread( |   93   void PostDeleteToOtherThread( | 
|   93       scoped_ptr<SequenceCheckedObject> sequence_checked_object) { |   94       scoped_ptr<SequenceCheckedObject> sequence_checked_object) { | 
|   94     other_thread()->message_loop()->DeleteSoon( |   95     other_thread()->message_loop()->DeleteSoon( | 
|   95         FROM_HERE, |   96         FROM_HERE, | 
|   96         sequence_checked_object.release()); |   97         sequence_checked_object.release()); | 
|   97   } |   98   } | 
|   98  |   99  | 
|   99   // Destroys the SequencedWorkerPool instance, blocking until it is fully shut |  100   // Destroys the SequencedWorkerPool instance, blocking until it is fully shut | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  324 #endif  // ENABLE_SEQUENCE_CHECKER |  325 #endif  // ENABLE_SEQUENCE_CHECKER | 
|  325  |  326  | 
|  326 #endif  // GTEST_HAS_DEATH_TEST || !ENABLE_SEQUENCE_CHECKER |  327 #endif  // GTEST_HAS_DEATH_TEST || !ENABLE_SEQUENCE_CHECKER | 
|  327  |  328  | 
|  328 }  // namespace |  329 }  // namespace | 
|  329  |  330  | 
|  330 }  // namespace base |  331 }  // namespace base | 
|  331  |  332  | 
|  332 // Just in case we ever get lumped together with other compilation units. |  333 // Just in case we ever get lumped together with other compilation units. | 
|  333 #undef ENABLE_SEQUENCE_CHECKER |  334 #undef ENABLE_SEQUENCE_CHECKER | 
| OLD | NEW |