Chromium Code Reviews

Side by Side Diff: chrome_frame/dll_redirector.h

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_FRAME_MODULE_UTILS_H_ 5 #ifndef CHROME_FRAME_MODULE_UTILS_H_
6 #define CHROME_FRAME_MODULE_UTILS_H_ 6 #define CHROME_FRAME_MODULE_UTILS_H_
7 7
8 #include <ObjBase.h> 8 #include <ObjBase.h>
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 15 matching lines...)
26 // 1) That different versions of the module this code is in reside in 26 // 1) That different versions of the module this code is in reside in
27 // neighbouring versioned directories, e.g. 27 // neighbouring versioned directories, e.g.
28 // C:\foo\bar\1.2.3.4\my_module.dll 28 // C:\foo\bar\1.2.3.4\my_module.dll
29 // C:\foo\bar\1.2.3.5\my_module.dll 29 // C:\foo\bar\1.2.3.5\my_module.dll
30 // 2) That the instance of this class will outlive the module that may be 30 // 2) That the instance of this class will outlive the module that may be
31 // delegated to. That is to say, that this class only guarantees that the 31 // delegated to. That is to say, that this class only guarantees that the
32 // module is loaded as long as this instance is active. 32 // module is loaded as long as this instance is active.
33 // 3) The module this is compiled into is built with version info. 33 // 3) The module this is compiled into is built with version info.
34 class DllRedirector { 34 class DllRedirector {
35 public: 35 public:
36 // Returns the singleton instance.
37 static DllRedirector* GetInstance();
38
36 virtual ~DllRedirector(); 39 virtual ~DllRedirector();
37 40
38 // Attempts to register this Chrome Frame version as the first loaded version 41 // Attempts to register this Chrome Frame version as the first loaded version
39 // on the system. If this succeeds, return true. If it fails, it returns 42 // on the system. If this succeeds, return true. If it fails, it returns
40 // false meaning that there is another version already loaded somewhere and 43 // false meaning that there is another version already loaded somewhere and
41 // the caller should delegate to that version instead. 44 // the caller should delegate to that version instead.
42 bool DllRedirector::RegisterAsFirstCFModule(); 45 bool DllRedirector::RegisterAsFirstCFModule();
43 46
44 // Unregisters the well known window class if we registered it earlier. 47 // Unregisters the well known window class if we registered it earlier.
45 // This is intended to be called from DllMain under PROCESS_DETACH. 48 // This is intended to be called from DllMain under PROCESS_DETACH.
(...skipping 46 matching lines...)
92 95
93 // Used for tests to override the name of the shared memory segment. 96 // Used for tests to override the name of the shared memory segment.
94 std::string shared_memory_name_; 97 std::string shared_memory_name_;
95 98
96 friend class ModuleUtilsTest; 99 friend class ModuleUtilsTest;
97 100
98 DISALLOW_COPY_AND_ASSIGN(DllRedirector); 101 DISALLOW_COPY_AND_ASSIGN(DllRedirector);
99 }; 102 };
100 103
101 #endif // CHROME_FRAME_MODULE_UTILS_H_ 104 #endif // CHROME_FRAME_MODULE_UTILS_H_
OLDNEW

Powered by Google App Engine