OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/environment.h" | 5 #include "mojo/public/utility/environment.h" |
6 | 6 |
7 #include "mojo/public/utility/bindings_support_impl.h" | 7 #include "mojo/public/utility/bindings_support_impl.h" |
8 #include "mojo/public/utility/run_loop.h" | 8 #include "mojo/public/utility/run_loop.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 namespace utility { | |
12 | 11 |
13 Environment::Environment() : bindings_support_(NULL) { | 12 Environment::Environment() : bindings_support_(NULL) { |
14 RunLoop::SetUp(); | 13 RunLoop::SetUp(); |
15 | 14 |
16 internal::BindingsSupportImpl::SetUp(); | 15 internal::BindingsSupportImpl::SetUp(); |
17 bindings_support_ = new internal::BindingsSupportImpl; | 16 bindings_support_ = new internal::BindingsSupportImpl; |
18 BindingsSupport::Set(bindings_support_); | 17 BindingsSupport::Set(bindings_support_); |
19 } | 18 } |
20 | 19 |
21 Environment::~Environment() { | 20 Environment::~Environment() { |
22 // Allow for someone to have replaced BindingsSupport. | 21 // Allow for someone to have replaced BindingsSupport. |
23 if (BindingsSupport::Get() == bindings_support_) | 22 if (BindingsSupport::Get() == bindings_support_) |
24 BindingsSupport::Set(NULL); | 23 BindingsSupport::Set(NULL); |
25 delete bindings_support_; | 24 delete bindings_support_; |
26 internal::BindingsSupportImpl::TearDown(); | 25 internal::BindingsSupportImpl::TearDown(); |
27 | 26 |
28 RunLoop::TearDown(); | 27 RunLoop::TearDown(); |
29 } | 28 } |
30 | 29 |
31 } // namespace utility | |
32 } // namespace mojo | 30 } // namespace mojo |
OLD | NEW |