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

Side by Side Diff: ppapi/shared_impl/ppapi_globals.h

Issue 10702188: Fix unit test to allow repeated successful runs by avoiding a function static variable in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ 5 #ifndef PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_
6 #define PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ 6 #define PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI( 98 virtual thunk::ResourceCreationAPI* GetResourceCreationAPI(
99 PP_Instance instance) = 0; 99 PP_Instance instance) = 0;
100 100
101 // Returns the PP_Module associated with the given PP_Instance, or 0 on 101 // Returns the PP_Module associated with the given PP_Instance, or 0 on
102 // failure. 102 // failure.
103 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0; 103 virtual PP_Module GetModuleForInstance(PP_Instance instance) = 0;
104 104
105 // Returns the base::MessageLoopProxy for the main thread. Note that this must 105 // Returns the base::MessageLoopProxy for the main thread. Note that this must
106 // be called on the main thread the first time so that it can initialize 106 // be called on the main thread the first time so that it can initialize
107 // its static data. 107 // its static data.
108 base::MessageLoopProxy* GetMainThreadMessageLoop(); 108 // Virtual for testing.
109 virtual base::MessageLoopProxy* GetMainThreadMessageLoop();
109 110
110 // Returns the command line for the process. 111 // Returns the command line for the process.
111 virtual std::string GetCmdLine() = 0; 112 virtual std::string GetCmdLine() = 0;
112 113
113 // Preloads the font on Windows, does nothing on other platforms. 114 // Preloads the font on Windows, does nothing on other platforms.
114 // TODO(brettw) remove this by passing the instance into the API so we don't 115 // TODO(brettw) remove this by passing the instance into the API so we don't
115 // have to have it on the globals. 116 // have to have it on the globals.
116 virtual void PreCacheFontForFlash(const void* logfontw) = 0; 117 virtual void PreCacheFontForFlash(const void* logfontw) = 0;
117 118
118 virtual bool IsHostGlobals() const; 119 virtual bool IsHostGlobals() const;
119 virtual bool IsPluginGlobals() const; 120 virtual bool IsPluginGlobals() const;
120 121
121 private: 122 private:
122 // Return the thread-local pointer which is used only for unit testing. It 123 // Return the thread-local pointer which is used only for unit testing. It
123 // should always be NULL when running in production. It allows separate 124 // should always be NULL when running in production. It allows separate
124 // threads to have distinct "globals". 125 // threads to have distinct "globals".
125 static PpapiGlobals* GetThreadLocalPointer(); 126 static PpapiGlobals* GetThreadLocalPointer();
126 127
127 static PpapiGlobals* ppapi_globals_; 128 static PpapiGlobals* ppapi_globals_;
128 129
129 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals); 130 DISALLOW_COPY_AND_ASSIGN(PpapiGlobals);
130 }; 131 };
131 132
132 } // namespace ppapi 133 } // namespace ppapi
133 134
134 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_ 135 #endif // PPAPI_SHARED_IMPL_PPAPI_GLOBALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698