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

Side by Side Diff: base/weak_ptr_unittest.cc

Issue 2982009: Revert everything related to the relanding. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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/observer_list_threadsafe.h ('k') | chrome/browser/autocomplete/autocomplete_edit.cc » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/thread.h" 7 #include "base/thread.h"
8 #include "base/scoped_ptr.h"
9 #include "base/weak_ptr.h" 8 #include "base/weak_ptr.h"
10 9
11 namespace base { 10 namespace base {
12 namespace { 11 namespace {
13 12
14 template <class T> 13 template <class T>
15 class OffThreadObjectCreator { 14 class OffThreadObjectCreator {
16 public: 15 public:
17 static T* NewObject() { 16 static T* NewObject() {
18 T* result; 17 T* result;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Test that it is OK to create a class that has a WeakPtr member on one 127 // Test that it is OK to create a class that has a WeakPtr member on one
129 // thread, but use it on another. This tests that we do not trip runtime 128 // thread, but use it on another. This tests that we do not trip runtime
130 // checks that ensure that a weak reference is not used by multiple threads. 129 // checks that ensure that a weak reference is not used by multiple threads.
131 scoped_ptr<Consumer> consumer(OffThreadObjectCreator<Consumer>::NewObject()); 130 scoped_ptr<Consumer> consumer(OffThreadObjectCreator<Consumer>::NewObject());
132 Producer producer; 131 Producer producer;
133 consumer->producer = producer.AsWeakPtr(); 132 consumer->producer = producer.AsWeakPtr();
134 EXPECT_EQ(&producer, consumer->producer.get()); 133 EXPECT_EQ(&producer, consumer->producer.get());
135 } 134 }
136 135
137 } // namespace base 136 } // namespace base
OLDNEW
« no previous file with comments | « base/observer_list_threadsafe.h ('k') | chrome/browser/autocomplete/autocomplete_edit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698