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

Unified Diff: mojo/environment/environment.cc

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
« no previous file with comments | « no previous file | mojo/public/cpp/application/lib/application_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/environment/environment.cc
diff --git a/mojo/environment/environment.cc b/mojo/environment/environment.cc
index 8867dd088342fc05e6af2788dd129edaefc5e306..aa7ab9834e14e2df086a716e16fe5d596f9f9860 100644
--- a/mojo/environment/environment.cc
+++ b/mojo/environment/environment.cc
@@ -10,32 +10,33 @@
namespace mojo {
-// These methods are intentionally not implemented so that there is a link
-// error if someone uses them in a Chromium-environment.
-#if 0
-Environment::Environment() {
-}
+// TODO(vtl): Probably we should share the following async waiter and logger
+// code with the "standalone" implementation. (The only difference is what the
+// |internal::kDefault...| are.)
-Environment::Environment(const MojoAsyncWaiter* default_async_waiter,
- const MojoLogger* default_logger) {
-}
+const MojoAsyncWaiter* g_default_async_waiter = &internal::kDefaultAsyncWaiter;
+const MojoLogger* g_default_logger = &internal::kDefaultLogger;
-Environment::~Environment() {
+// static
+const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() {
+ return g_default_async_waiter;
}
-#endif
// static
-const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() {
- return &internal::kDefaultAsyncWaiter;
+void Environment::SetDefaultAsyncWaiter(const MojoAsyncWaiter* async_waiter) {
+ g_default_async_waiter =
+ async_waiter ? async_waiter : &internal::kDefaultAsyncWaiter;
}
// static
const MojoLogger* Environment::GetDefaultLogger() {
- return &internal::kDefaultLogger;
+ return g_default_logger;
}
// static
-void Environment::SetDefaultLogger(const MojoLogger* logger) {}
+void Environment::SetDefaultLogger(const MojoLogger* logger) {
+ g_default_logger = logger ? logger : &internal::kDefaultLogger;
+}
// static
void Environment::InstantiateDefaultRunLoop() {
« no previous file with comments | « no previous file | mojo/public/cpp/application/lib/application_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698