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

Unified Diff: mojo/public/cpp/environment/environment.h

Issue 1997473005: Remove requirement that mojo::Environment be instantiated. (Closed) Base URL: https://github.com/domokit/mojo.git@work797_no_utility_tls
Patch Set: SetDefaultAsyncWaiter Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/environment/environment.h
diff --git a/mojo/public/cpp/environment/environment.h b/mojo/public/cpp/environment/environment.h
index 85d17992c0a865f6f4f5e2b0a5a34ecef5c4e931..6c544ee9f0bbc97baebf550114beb960ab7670ae 100644
--- a/mojo/public/cpp/environment/environment.h
+++ b/mojo/public/cpp/environment/environment.h
@@ -12,27 +12,19 @@ struct MojoLogger;
namespace mojo {
-// Other parts of the Mojo C++ APIs use the *static* methods of this class.
-//
-// The "standalone" implementation of this class requires that this class (in
-// the lib/ subdirectory) be instantiated (and remain so) while using the Mojo
-// C++ APIs. I.e., the static methods depend on things set up by the constructor
-// and torn down by the destructor.
-//
-// Other implementations may not have this requirement.
+// This class just acts as a "namespace": it only has static methods (whose
+// implementation may be varied). Note that some implementations may require
+// their own explicit initialization/shut down functions to be called.
class Environment {
public:
- Environment();
- // This constructor allows the standard implementations to be overridden (set
- // a parameter to null to get the standard implementation).
- Environment(const MojoAsyncWaiter* default_async_waiter,
- const MojoLogger* default_logger);
- ~Environment();
-
static const MojoAsyncWaiter* GetDefaultAsyncWaiter();
+ // Setting the default async waiter to null will use the original default
+ // implementation.
+ static void SetDefaultAsyncWaiter(const MojoAsyncWaiter* async_waiter);
static const MojoLogger* GetDefaultLogger();
- // Setting the logger to null will use the standard implementation.
+ // Setting the logger to null will use the will use the original default
+ // implementation.
static void SetDefaultLogger(const MojoLogger* logger);
// These instantiate and destroy an environment-specific run loop for the
@@ -44,7 +36,8 @@ class Environment {
static void DestroyDefaultRunLoop();
private:
- MOJO_DISALLOW_COPY_AND_ASSIGN(Environment);
+ Environment() = delete;
+ ~Environment() = delete;
};
} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/tests/validation_unittest.cc ('k') | mojo/public/cpp/environment/lib/environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698