Commit ae5537fe authored by tfarina@chromium.org's avatar tfarina@chromium.org

base: Suggest forward declare DefaultSingletonTraits in header files.

Instead of including singleton.h in header files we can forward declare it,
and include only in the source file.

There is also a presubmit check for this, I didn't know ;)

R=willchan@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10835029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149095 0039d316-1c4b-4281-b951-d872f2087c98
parent 8991f2b1
...@@ -149,7 +149,7 @@ template <typename Type> base::subtle::Atomic32 ...@@ -149,7 +149,7 @@ template <typename Type> base::subtle::Atomic32
// Example usage: // Example usage:
// //
// In your header: // In your header:
// #include "base/memory/singleton.h" // template <typename T> struct DefaultSingletonTraits;
// class FooClass { // class FooClass {
// public: // public:
// static FooClass* GetInstance(); <-- See comment below on this. // static FooClass* GetInstance(); <-- See comment below on this.
...@@ -162,6 +162,7 @@ template <typename Type> base::subtle::Atomic32 ...@@ -162,6 +162,7 @@ template <typename Type> base::subtle::Atomic32
// }; // };
// //
// In your source file: // In your source file:
// #include "base/memory/singleton.h"
// FooClass* FooClass::GetInstance() { // FooClass* FooClass::GetInstance() {
// return Singleton<FooClass>::get(); // return Singleton<FooClass>::get();
// } // }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment