Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This defines a set of argument wrappers and related factory methods that | 5 // This defines a set of argument wrappers and related factory methods that |
| 6 // can be used specify the refcounting and reference semantics of arguments | 6 // can be used specify the refcounting and reference semantics of arguments |
| 7 // that are bound by the Bind() function in base/bind.h. | 7 // that are bound by the Bind() function in base/bind.h. |
| 8 // | 8 // |
| 9 // It also defines a set of simple functions and utilities that people want | 9 // It also defines a set of simple functions and utilities that people want |
| 10 // when using Callback<> and Bind(). | 10 // when using Callback<> and Bind(). |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 typedef char No[2]; | 230 typedef char No[2]; |
| 231 | 231 |
| 232 struct BaseMixin { | 232 struct BaseMixin { |
| 233 void AddRef(); | 233 void AddRef(); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 // MSVC warns when you try to use Base if T has a private destructor, the | 236 // MSVC warns when you try to use Base if T has a private destructor, the |
| 237 // common pattern for refcounted types. It does this even though no attempt to | 237 // common pattern for refcounted types. It does this even though no attempt to |
| 238 // instantiate Base is made. We disable the warning for this definition. | 238 // instantiate Base is made. We disable the warning for this definition. |
| 239 #if defined(OS_WIN) | 239 #if defined(OS_WIN) |
| 240 #pragma warning(push) | |
| 240 #pragma warning(disable:4624) | 241 #pragma warning(disable:4624) |
| 241 #endif | 242 #endif |
| 242 struct Base : public T, public BaseMixin { | 243 struct Base : public T, public BaseMixin { |
| 243 }; | 244 }; |
| 244 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
| 245 #pragma warning(default:4624) | 246 #pragma warning(pop) |
|
erikwright (departed)
2013/07/26 15:17:56
One could just pull the push outside of the #if de
awong
2013/07/26 17:50:09
I'm confused...don't the pragmas need to be inside
| |
| 246 #endif | 247 #endif |
| 247 | 248 |
| 248 template <void(BaseMixin::*)(void)> struct Helper {}; | 249 template <void(BaseMixin::*)(void)> struct Helper {}; |
| 249 | 250 |
| 250 template <typename C> | 251 template <typename C> |
| 251 static No& Check(Helper<&C::AddRef>*); | 252 static No& Check(Helper<&C::AddRef>*); |
| 252 | 253 |
| 253 template <typename > | 254 template <typename > |
| 254 static Yes& Check(...); | 255 static Yes& Check(...); |
| 255 | 256 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 | 554 |
| 554 private: | 555 private: |
| 555 Closure closure_; | 556 Closure closure_; |
| 556 | 557 |
| 557 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner); | 558 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner); |
| 558 }; | 559 }; |
| 559 | 560 |
| 560 } // namespace base | 561 } // namespace base |
| 561 | 562 |
| 562 #endif // BASE_BIND_HELPERS_H_ | 563 #endif // BASE_BIND_HELPERS_H_ |
| OLD | NEW |