| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ | |
| 6 #define MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ | |
| 7 | |
| 8 #include "mojo/public/cpp/system/macros.h" | |
| 9 | |
| 10 struct MojoAsyncWaiter; | |
| 11 struct MojoLogger; | |
| 12 | |
| 13 namespace mojo { | |
| 14 | |
| 15 // This class just acts as a "namespace": it only has static methods (whose | |
| 16 // implementation may be varied). Note that some implementations may require | |
| 17 // their own explicit initialization/shut down functions to be called. | |
| 18 class Environment { | |
| 19 public: | |
| 20 static const MojoAsyncWaiter* GetDefaultAsyncWaiter(); | |
| 21 // Setting the default async waiter to null will use the original default | |
| 22 // implementation. | |
| 23 static void SetDefaultAsyncWaiter(const MojoAsyncWaiter* async_waiter); | |
| 24 | |
| 25 static const MojoLogger* GetDefaultLogger(); | |
| 26 // Setting the logger to null will use the will use the original default | |
| 27 // implementation. | |
| 28 static void SetDefaultLogger(const MojoLogger* logger); | |
| 29 | |
| 30 // These instantiate and destroy an environment-specific run loop for the | |
| 31 // current thread, allowing |GetDefaultAsyncWaiter()| to be used. (The run | |
| 32 // loop itself should be accessible via thread-local storage, using methods | |
| 33 // specific to the run loop implementation.) Creating and destroying nested | |
| 34 // run loops is not supported. | |
| 35 static void InstantiateDefaultRunLoop(); | |
| 36 static void DestroyDefaultRunLoop(); | |
| 37 | |
| 38 private: | |
| 39 Environment() = delete; | |
| 40 ~Environment() = delete; | |
| 41 }; | |
| 42 | |
| 43 } // namespace mojo | |
| 44 | |
| 45 #endif // MOJO_PUBLIC_CPP_ENVIRONMENT_ENVIRONMENT_H_ | |
| OLD | NEW |