| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void MojoShellConnectionImpl::WaitForShell( | 65 void MojoShellConnectionImpl::WaitForShell( |
| 66 mojo::ScopedMessagePipeHandle handle) { | 66 mojo::ScopedMessagePipeHandle handle) { |
| 67 mojo::ApplicationRequest application_request; | 67 mojo::ApplicationRequest application_request; |
| 68 runner_connection_.reset(mojo::shell::RunnerConnection::ConnectToRunner( | 68 runner_connection_.reset(mojo::shell::RunnerConnection::ConnectToRunner( |
| 69 &application_request, std::move(handle))); | 69 &application_request, std::move(handle))); |
| 70 application_impl_.reset( | 70 application_impl_.reset( |
| 71 new mojo::ApplicationImpl(this, std::move(application_request))); | 71 new mojo::ApplicationImpl(this, std::move(application_request))); |
| 72 application_impl_->WaitForInitialize(); | 72 application_impl_->WaitForInitialize(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void MojoShellConnectionImpl::Initialize(mojo::ApplicationImpl* application) { | 75 void MojoShellConnectionImpl::Initialize(mojo::Shell* shell, |
| 76 const std::string& url, |
| 77 uint32_t id) { |
| 76 initialized_ = true; | 78 initialized_ = true; |
| 77 } | 79 } |
| 78 | 80 |
| 79 bool MojoShellConnectionImpl::AcceptConnection( | 81 bool MojoShellConnectionImpl::AcceptConnection( |
| 80 mojo::ApplicationConnection* connection) { | 82 mojo::ApplicationConnection* connection) { |
| 81 bool found = false; | 83 bool found = false; |
| 82 for (auto listener : listeners_) | 84 for (auto listener : listeners_) |
| 83 found |= listener->AcceptConnection(connection); | 85 found |= listener->AcceptConnection(connection); |
| 84 return found; | 86 return found; |
| 85 } | 87 } |
| 86 | 88 |
| 87 mojo::ApplicationImpl* MojoShellConnectionImpl::GetApplication() { | 89 mojo::Shell* MojoShellConnectionImpl::GetShell() { |
| 88 DCHECK(initialized_); | 90 DCHECK(initialized_); |
| 89 return application_impl_.get(); | 91 return application_impl_.get(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void MojoShellConnectionImpl::AddListener(Listener* listener) { | 94 void MojoShellConnectionImpl::AddListener(Listener* listener) { |
| 93 DCHECK(std::find(listeners_.begin(), listeners_.end(), listener) == | 95 DCHECK(std::find(listeners_.begin(), listeners_.end(), listener) == |
| 94 listeners_.end()); | 96 listeners_.end()); |
| 95 listeners_.push_back(listener); | 97 listeners_.push_back(listener); |
| 96 } | 98 } |
| 97 | 99 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 // static | 111 // static |
| 110 void MojoShellConnection::Destroy() { | 112 void MojoShellConnection::Destroy() { |
| 111 // This joins the shell controller thread. | 113 // This joins the shell controller thread. |
| 112 delete Get(); | 114 delete Get(); |
| 113 lazy_tls_ptr.Pointer()->Set(nullptr); | 115 lazy_tls_ptr.Pointer()->Set(nullptr); |
| 114 } | 116 } |
| 115 | 117 |
| 116 MojoShellConnection::~MojoShellConnection() {} | 118 MojoShellConnection::~MojoShellConnection() {} |
| 117 | 119 |
| 118 } // namespace content | 120 } // namespace content |
| OLD | NEW |