| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/embedded_application_runner.h" | 5 #include "content/common/mojo/embedded_application_runner.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // different from the one that created it. | 29 // different from the one that created it. |
| 30 thread_checker_.DetachFromThread(); | 30 thread_checker_.DetachFromThread(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void BindShellClientRequest(shell::mojom::ShellClientRequest request) { | 33 void BindShellClientRequest(shell::mojom::ShellClientRequest request) { |
| 34 DCHECK(thread_checker_.CalledOnValidThread()); | 34 DCHECK(thread_checker_.CalledOnValidThread()); |
| 35 | 35 |
| 36 if (!shell_client_) | 36 if (!shell_client_) |
| 37 shell_client_ = factory_callback_.Run(); | 37 shell_client_ = factory_callback_.Run(); |
| 38 | 38 |
| 39 std::unique_ptr<shell::ShellConnection> new_connection( | 39 shell::ShellConnection* new_connection = |
| 40 new shell::ShellConnection(shell_client_.get(), std::move(request))); | 40 new shell::ShellConnection(shell_client_.get(), std::move(request)); |
| 41 new_connection->set_connection_lost_closure( | 41 shell_connections_.push_back(base::WrapUnique(new_connection)); |
| 42 base::Bind(&Instance::OnShellConnectionLost, | 42 new_connection->SetConnectionLostClosure( |
| 43 base::Unretained(this), new_connection.get())); | 43 base::Bind(&Instance::OnShellConnectionLost, base::Unretained(this), |
| 44 shell_connections_.push_back(std::move(new_connection)); | 44 new_connection)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class base::RefCountedThreadSafe<Instance>; | 48 friend class base::RefCountedThreadSafe<Instance>; |
| 49 | 49 |
| 50 ~Instance() { DCHECK(thread_checker_.CalledOnValidThread()); } | 50 ~Instance() { DCHECK(thread_checker_.CalledOnValidThread()); } |
| 51 | 51 |
| 52 void OnShellConnectionLost(shell::ShellConnection* connection) { | 52 void OnShellConnectionLost(shell::ShellConnection* connection) { |
| 53 DCHECK(thread_checker_.CalledOnValidThread()); | 53 DCHECK(thread_checker_.CalledOnValidThread()); |
| 54 | 54 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void EmbeddedApplicationRunner::SetQuitClosure( | 101 void EmbeddedApplicationRunner::SetQuitClosure( |
| 102 const base::Closure& quit_closure) { | 102 const base::Closure& quit_closure) { |
| 103 quit_closure_ = quit_closure; | 103 quit_closure_ = quit_closure; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void EmbeddedApplicationRunner::OnQuit() { | 106 void EmbeddedApplicationRunner::OnQuit() { |
| 107 quit_closure_.Run(); | 107 quit_closure_.Run(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace content | 110 } // namespace content |
| OLD | NEW |