| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/mojo/mojo_shell_connection_impl.h" | 5 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 bool MojoShellConnectionImpl::ConfigureIncomingConnection( | 77 bool MojoShellConnectionImpl::ConfigureIncomingConnection( |
| 78 mojo::ApplicationConnection* connection) { | 78 mojo::ApplicationConnection* connection) { |
| 79 bool found = false; | 79 bool found = false; |
| 80 for (auto listener : listeners_) | 80 for (auto listener : listeners_) |
| 81 found |= listener->ConfigureIncomingConnection(connection); | 81 found |= listener->ConfigureIncomingConnection(connection); |
| 82 return found; | 82 return found; |
| 83 } | 83 } |
| 84 | 84 |
| 85 mojo::ApplicationImpl* MojoShellConnectionImpl::GetApplication() { | 85 mojo::ApplicationImpl* MojoShellConnectionImpl::GetApplication() { |
| 86 DCHECK(initialized_); | |
| 87 return application_impl_.get(); | 86 return application_impl_.get(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void MojoShellConnectionImpl::AddListener(Listener* listener) { | 89 void MojoShellConnectionImpl::AddListener(Listener* listener) { |
| 91 DCHECK(std::find(listeners_.begin(), listeners_.end(), listener) == | 90 DCHECK(std::find(listeners_.begin(), listeners_.end(), listener) == |
| 92 listeners_.end()); | 91 listeners_.end()); |
| 93 listeners_.push_back(listener); | 92 listeners_.push_back(listener); |
| 94 } | 93 } |
| 95 | 94 |
| 96 void MojoShellConnectionImpl::RemoveListener(Listener* listener) { | 95 void MojoShellConnectionImpl::RemoveListener(Listener* listener) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 // static | 106 // static |
| 108 void MojoShellConnection::Destroy() { | 107 void MojoShellConnection::Destroy() { |
| 109 // This joins the shell controller thread. | 108 // This joins the shell controller thread. |
| 110 delete Get(); | 109 delete Get(); |
| 111 lazy_tls_ptr.Pointer()->Set(nullptr); | 110 lazy_tls_ptr.Pointer()->Set(nullptr); |
| 112 } | 111 } |
| 113 | 112 |
| 114 MojoShellConnection::~MojoShellConnection() {} | 113 MojoShellConnection::~MojoShellConnection() {} |
| 115 | 114 |
| 116 } // namespace content | 115 } // namespace content |
| OLD | NEW |