OLD | NEW |
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 #include "base/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.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/googletest/include/gtest/gtest.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 namespace { | 19 namespace { |
20 | 20 |
21 template <class T> | 21 template <class T> |
22 class OffThreadObjectCreator { | 22 class OffThreadObjectCreator { |
23 public: | 23 public: |
24 static T* NewObject() { | 24 static T* NewObject() { |
25 T* result; | 25 T* result; |
26 { | 26 { |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 background.Start(); | 602 background.Start(); |
603 background.DeleteTarget(target.release()); | 603 background.DeleteTarget(target.release()); |
604 | 604 |
605 // Main thread attempts to dereference the target, violating thread binding. | 605 // Main thread attempts to dereference the target, violating thread binding. |
606 ASSERT_DEATH(arrow.target.get(), ""); | 606 ASSERT_DEATH(arrow.target.get(), ""); |
607 } | 607 } |
608 | 608 |
609 #endif | 609 #endif |
610 | 610 |
611 } // namespace base | 611 } // namespace base |
OLD | NEW |