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

Side by Side Diff: webrtc/base/sigslot_unittest.cc

Issue 2509733003: Rewrite of sigslot that avoids vtables. (Closed)
Patch Set: Attempting to fix Windows issue due to different function pointer sizes. Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 typedef SigslotSlotTest<> SigslotSTSlotTest; 97 typedef SigslotSlotTest<> SigslotSTSlotTest;
98 typedef SigslotSlotTest<sigslot::multi_threaded_local, 98 typedef SigslotSlotTest<sigslot::multi_threaded_local,
99 sigslot::multi_threaded_local> SigslotMTSlotTest; 99 sigslot::multi_threaded_local> SigslotMTSlotTest;
100 100
101 class multi_threaded_local_fake : public sigslot::multi_threaded_local { 101 class multi_threaded_local_fake : public sigslot::multi_threaded_local {
102 public: 102 public:
103 multi_threaded_local_fake() : lock_count_(0), unlock_count_(0) { 103 multi_threaded_local_fake() : lock_count_(0), unlock_count_(0) {
104 } 104 }
105 105
106 virtual void lock() { 106 void lock() { ++lock_count_; }
107 ++lock_count_; 107 void unlock() { ++unlock_count_; }
108 }
109 virtual void unlock() {
110 ++unlock_count_;
111 }
112 108
113 int lock_count() { return lock_count_; } 109 int lock_count() { return lock_count_; }
114 110
115 bool InCriticalSection() { return lock_count_ != unlock_count_; } 111 bool InCriticalSection() { return lock_count_ != unlock_count_; }
116 112
117 protected: 113 protected:
118 int lock_count_; 114 int lock_count_;
119 int unlock_count_; 115 int unlock_count_;
120 }; 116 };
121 117
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 sigslot::signal0<>* signal = new sigslot::signal0<>; 237 sigslot::signal0<>* signal = new sigslot::signal0<>;
242 SigslotReceiver<>* receiver = new SigslotReceiver<>(); 238 SigslotReceiver<>* receiver = new SigslotReceiver<>();
243 receiver->Connect(signal); 239 receiver->Connect(signal);
244 (*signal)(); 240 (*signal)();
245 EXPECT_EQ(1, receiver->signal_count()); 241 EXPECT_EQ(1, receiver->signal_count());
246 242
247 delete receiver; 243 delete receiver;
248 (*signal)(); 244 (*signal)();
249 delete signal; 245 delete signal;
250 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698