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

Side by Side Diff: base/threading/thread_local_storage_unittest.cc

Issue 10004001: Add virtual and OVERRIDE to base/ implementation files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win Fix -> Missing header Created 8 years, 8 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 | Annotate | Revision Log
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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #include <process.h> 7 #include <process.h>
8 #endif 8 #endif
9 9
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 17 matching lines...) Expand all
28 28
29 static ThreadLocalStorage::StaticSlot tls_slot = TLS_INITIALIZER; 29 static ThreadLocalStorage::StaticSlot tls_slot = TLS_INITIALIZER;
30 30
31 class ThreadLocalStorageRunner : public DelegateSimpleThread::Delegate { 31 class ThreadLocalStorageRunner : public DelegateSimpleThread::Delegate {
32 public: 32 public:
33 explicit ThreadLocalStorageRunner(int* tls_value_ptr) 33 explicit ThreadLocalStorageRunner(int* tls_value_ptr)
34 : tls_value_ptr_(tls_value_ptr) {} 34 : tls_value_ptr_(tls_value_ptr) {}
35 35
36 virtual ~ThreadLocalStorageRunner() {} 36 virtual ~ThreadLocalStorageRunner() {}
37 37
38 virtual void Run() { 38 virtual void Run() OVERRIDE {
39 *tls_value_ptr_ = kInitialTlsValue; 39 *tls_value_ptr_ = kInitialTlsValue;
40 tls_slot.Set(tls_value_ptr_); 40 tls_slot.Set(tls_value_ptr_);
41 41
42 int *ptr = static_cast<int*>(tls_slot.Get()); 42 int *ptr = static_cast<int*>(tls_slot.Get());
43 EXPECT_EQ(ptr, tls_value_ptr_); 43 EXPECT_EQ(ptr, tls_value_ptr_);
44 EXPECT_EQ(*ptr, kInitialTlsValue); 44 EXPECT_EQ(*ptr, kInitialTlsValue);
45 *tls_value_ptr_ = 0; 45 *tls_value_ptr_ = 0;
46 46
47 ptr = static_cast<int*>(tls_slot.Get()); 47 ptr = static_cast<int*>(tls_slot.Get());
48 EXPECT_EQ(ptr, tls_value_ptr_); 48 EXPECT_EQ(ptr, tls_value_ptr_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 delete threads[index]; 105 delete threads[index];
106 delete thread_delegates[index]; 106 delete thread_delegates[index];
107 107
108 // Verify that the destructor was called and that we reset. 108 // Verify that the destructor was called and that we reset.
109 EXPECT_EQ(values[index], kFinalTlsValue); 109 EXPECT_EQ(values[index], kFinalTlsValue);
110 } 110 }
111 tls_slot.Free(); // Stop doing callbacks to cleanup threads. 111 tls_slot.Free(); // Stop doing callbacks to cleanup threads.
112 } 112 }
113 113
114 } // namespace base 114 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/thread_collision_warner_unittest.cc ('k') | base/threading/thread_local_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698