| 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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "mojo/environment/default_async_waiter.h" | 8 #include "mojo/environment/default_async_waiter.h" |
| 9 #include "mojo/environment/default_logger.h" | 9 #include "mojo/environment/default_logger.h" |
| 10 | 10 |
| 11 namespace mojo { | 11 namespace mojo { |
| 12 | 12 |
| 13 // These methods are intentionally not implemented so that there is a link | |
| 14 // error if someone uses them in a Chromium-environment. | |
| 15 #if 0 | |
| 16 Environment::Environment() { | |
| 17 } | |
| 18 | |
| 19 Environment::Environment(const MojoAsyncWaiter* default_async_waiter, | |
| 20 const MojoLogger* default_logger) { | |
| 21 } | |
| 22 | |
| 23 Environment::~Environment() { | |
| 24 } | |
| 25 #endif | |
| 26 | |
| 27 // static | 13 // static |
| 28 const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() { | 14 const MojoAsyncWaiter* Environment::GetDefaultAsyncWaiter() { |
| 29 return &internal::kDefaultAsyncWaiter; | 15 return &internal::kDefaultAsyncWaiter; |
| 30 } | 16 } |
| 31 | 17 |
| 32 // static | 18 // static |
| 33 const MojoLogger* Environment::GetDefaultLogger() { | 19 const MojoLogger* Environment::GetDefaultLogger() { |
| 34 return &internal::kDefaultLogger; | 20 return &internal::kDefaultLogger; |
| 35 } | 21 } |
| 36 | 22 |
| 37 // static | 23 // static |
| 38 void Environment::SetDefaultLogger(const MojoLogger* logger) {} | 24 void Environment::SetDefaultLogger(const MojoLogger* logger) {} |
| 39 | 25 |
| 40 // static | 26 // static |
| 41 void Environment::InstantiateDefaultRunLoop() { | 27 void Environment::InstantiateDefaultRunLoop() { |
| 42 CHECK(!base::MessageLoop::current()); | 28 CHECK(!base::MessageLoop::current()); |
| 43 // Not leaked: accessible from |base::MessageLoop::current()|. | 29 // Not leaked: accessible from |base::MessageLoop::current()|. |
| 44 base::MessageLoop* message_loop = new base::MessageLoop(); | 30 base::MessageLoop* message_loop = new base::MessageLoop(); |
| 45 CHECK_EQ(message_loop, base::MessageLoop::current()); | 31 CHECK_EQ(message_loop, base::MessageLoop::current()); |
| 46 } | 32 } |
| 47 | 33 |
| 48 // static | 34 // static |
| 49 void Environment::DestroyDefaultRunLoop() { | 35 void Environment::DestroyDefaultRunLoop() { |
| 50 CHECK(base::MessageLoop::current()); | 36 CHECK(base::MessageLoop::current()); |
| 51 delete base::MessageLoop::current(); | 37 delete base::MessageLoop::current(); |
| 52 CHECK(!base::MessageLoop::current()); | 38 CHECK(!base::MessageLoop::current()); |
| 53 } | 39 } |
| 54 | 40 |
| 55 } // namespace mojo | 41 } // namespace mojo |
| OLD | NEW |