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

Side by Side Diff: base/memory/weak_ptr_unittest.cc

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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/memory/shared_memory_unittest.cc ('k') | base/message_loop/message_loop.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 (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"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 TargetWithFactory() : factory(this) {} 55 TargetWithFactory() : factory(this) {}
56 WeakPtrFactory<Target> factory; 56 WeakPtrFactory<Target> factory;
57 }; 57 };
58 58
59 // Helper class to create and destroy weak pointer copies 59 // Helper class to create and destroy weak pointer copies
60 // and delete objects on a background thread. 60 // and delete objects on a background thread.
61 class BackgroundThread : public Thread { 61 class BackgroundThread : public Thread {
62 public: 62 public:
63 BackgroundThread() : Thread("owner_thread") {} 63 BackgroundThread() : Thread("owner_thread") {}
64 64
65 virtual ~BackgroundThread() { 65 ~BackgroundThread() override { Stop(); }
66 Stop();
67 }
68 66
69 void CreateArrowFromTarget(Arrow** arrow, Target* target) { 67 void CreateArrowFromTarget(Arrow** arrow, Target* target) {
70 WaitableEvent completion(true, false); 68 WaitableEvent completion(true, false);
71 message_loop()->PostTask( 69 message_loop()->PostTask(
72 FROM_HERE, 70 FROM_HERE,
73 base::Bind(&BackgroundThread::DoCreateArrowFromTarget, 71 base::Bind(&BackgroundThread::DoCreateArrowFromTarget,
74 arrow, target, &completion)); 72 arrow, target, &completion));
75 completion.Wait(); 73 completion.Wait();
76 } 74 }
77 75
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 background.Start(); 607 background.Start();
610 background.DeleteTarget(target.release()); 608 background.DeleteTarget(target.release());
611 609
612 // Main thread attempts to dereference the target, violating thread binding. 610 // Main thread attempts to dereference the target, violating thread binding.
613 ASSERT_DEATH(arrow.target.get(), ""); 611 ASSERT_DEATH(arrow.target.get(), "");
614 } 612 }
615 613
616 #endif 614 #endif
617 615
618 } // namespace base 616 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698