OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "mojo/public/cpp/environment/environment.h" | 5 #include "mojo/public/cpp/environment/environment.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 | 8 |
9 #include "mojo/public/c/environment/logger.h" | 9 #include "mojo/public/c/environment/logger.h" |
10 #include "mojo/public/cpp/environment/lib/default_async_waiter.h" | 10 #include "mojo/public/cpp/environment/lib/default_async_waiter.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 assert(g_default_async_waiter); // Fails if not "inside" |Environment|. | 54 assert(g_default_async_waiter); // Fails if not "inside" |Environment|. |
55 return g_default_async_waiter; | 55 return g_default_async_waiter; |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 const MojoLogger* Environment::GetDefaultLogger() { | 59 const MojoLogger* Environment::GetDefaultLogger() { |
60 assert(g_default_logger); // Fails if not "inside" |Environment|. | 60 assert(g_default_logger); // Fails if not "inside" |Environment|. |
61 return g_default_logger; | 61 return g_default_logger; |
62 } | 62 } |
63 | 63 |
| 64 // static |
| 65 void Environment::InstantiateDefaultRunLoop() { |
| 66 assert(!RunLoop::current()); |
| 67 // Not leaked: accessible from |RunLoop::current()|. |
| 68 RunLoop* run_loop = new RunLoop(); |
| 69 MOJO_ALLOW_UNUSED_LOCAL(run_loop); |
| 70 assert(run_loop == RunLoop::current()); |
| 71 } |
| 72 |
| 73 // static |
| 74 void Environment::DestroyDefaultRunLoop() { |
| 75 assert(RunLoop::current()); |
| 76 delete RunLoop::current(); |
| 77 assert(!RunLoop::current()); |
| 78 } |
| 79 |
64 } // namespace mojo | 80 } // namespace mojo |
OLD | NEW |