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

Side by Side Diff: extensions/browser/extension_function.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/browser/extension_function.h" 5 #include "extensions/browser/extension_function.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // alive. 134 // alive.
135 bool HaveGesture(); 135 bool HaveGesture();
136 136
137 // These should be called when a ScopedUserGestureForTests object is 137 // These should be called when a ScopedUserGestureForTests object is
138 // created/destroyed respectively. 138 // created/destroyed respectively.
139 void IncrementCount(); 139 void IncrementCount();
140 void DecrementCount(); 140 void DecrementCount();
141 141
142 private: 142 private:
143 UserGestureForTests(); 143 UserGestureForTests();
144 friend struct DefaultSingletonTraits<UserGestureForTests>; 144 friend struct base::DefaultSingletonTraits<UserGestureForTests>;
145 145
146 base::Lock lock_; // for protecting access to count_ 146 base::Lock lock_; // for protecting access to count_
147 int count_; 147 int count_;
148 }; 148 };
149 149
150 // static 150 // static
151 UserGestureForTests* UserGestureForTests::GetInstance() { 151 UserGestureForTests* UserGestureForTests::GetInstance() {
152 return Singleton<UserGestureForTests>::get(); 152 return base::Singleton<UserGestureForTests>::get();
153 } 153 }
154 154
155 UserGestureForTests::UserGestureForTests() : count_(0) {} 155 UserGestureForTests::UserGestureForTests() : count_(0) {}
156 156
157 bool UserGestureForTests::HaveGesture() { 157 bool UserGestureForTests::HaveGesture() {
158 base::AutoLock autolock(lock_); 158 base::AutoLock autolock(lock_);
159 return count_ > 0; 159 return count_ > 0;
160 } 160 }
161 161
162 void UserGestureForTests::IncrementCount() { 162 void UserGestureForTests::IncrementCount() {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 552
553 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { 553 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() {
554 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); 554 return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_));
555 } 555 }
556 556
557 // static 557 // static
558 bool SyncIOThreadExtensionFunction::ValidationFailure( 558 bool SyncIOThreadExtensionFunction::ValidationFailure(
559 SyncIOThreadExtensionFunction* function) { 559 SyncIOThreadExtensionFunction* function) {
560 return false; 560 return false;
561 } 561 }
OLDNEW
« no previous file with comments | « extensions/browser/event_router_factory.cc ('k') | extensions/browser/extension_function_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698