| 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/service_manager/service_manager_connection_impl.h" | 5 #include "content/common/service_manager/service_manager_connection_impl.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 service_manager::mojom::ServiceFactoryRequest request) override { | 287 service_manager::mojom::ServiceFactoryRequest request) override { |
| 288 DCHECK(io_thread_checker_.CalledOnValidThread()); | 288 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 289 factory_bindings_.AddBinding(this, std::move(request)); | 289 factory_bindings_.AddBinding(this, std::move(request)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 ///////////////////////////////////////////////////////////////////////////// | 292 ///////////////////////////////////////////////////////////////////////////// |
| 293 // service_manager::mojom::ServiceFactory implementation | 293 // service_manager::mojom::ServiceFactory implementation |
| 294 | 294 |
| 295 void CreateService(service_manager::mojom::ServiceRequest request, | 295 void CreateService(service_manager::mojom::ServiceRequest request, |
| 296 const std::string& name) override { | 296 const std::string& name) override { |
| 297 LOG(INFO) << "ServiceManagerConnectionImpl::IOThreadContext::CreateService"; |
| 297 DCHECK(io_thread_checker_.CalledOnValidThread()); | 298 DCHECK(io_thread_checker_.CalledOnValidThread()); |
| 298 callback_task_runner_->PostTask( | 299 callback_task_runner_->PostTask( |
| 299 FROM_HERE, | 300 FROM_HERE, |
| 300 base::Bind(create_service_callback_, base::Passed(&request), name)); | 301 base::Bind(create_service_callback_, base::Passed(&request), name)); |
| 301 } | 302 } |
| 302 | 303 |
| 303 static void CallBinderOnTaskRunner( | 304 static void CallBinderOnTaskRunner( |
| 304 scoped_refptr<base::SequencedTaskRunner> task_runner, | 305 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 305 const service_manager::InterfaceRegistry::Binder& binder, | 306 const service_manager::InterfaceRegistry::Binder& binder, |
| 306 const std::string& interface_name, | 307 const std::string& interface_name, |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 509 |
| 509 void ServiceManagerConnectionImpl::RemoveOnConnectHandler(int id) { | 510 void ServiceManagerConnectionImpl::RemoveOnConnectHandler(int id) { |
| 510 auto it = on_connect_handlers_.find(id); | 511 auto it = on_connect_handlers_.find(id); |
| 511 DCHECK(it != on_connect_handlers_.end()); | 512 DCHECK(it != on_connect_handlers_.end()); |
| 512 on_connect_handlers_.erase(it); | 513 on_connect_handlers_.erase(it); |
| 513 } | 514 } |
| 514 | 515 |
| 515 void ServiceManagerConnectionImpl::CreateService( | 516 void ServiceManagerConnectionImpl::CreateService( |
| 516 service_manager::mojom::ServiceRequest request, | 517 service_manager::mojom::ServiceRequest request, |
| 517 const std::string& name) { | 518 const std::string& name) { |
| 519 LOG(INFO) << "ServiceManagerConnectionImpl::CreateService"; |
| 520 for (const auto& handler : request_handlers_) |
| 521 LOG(INFO) << "handler: " << handler.first; |
| 518 auto it = request_handlers_.find(name); | 522 auto it = request_handlers_.find(name); |
| 519 if (it != request_handlers_.end()) | 523 if (it != request_handlers_.end()) |
| 520 it->second.Run(std::move(request)); | 524 it->second.Run(std::move(request)); |
| 525 else |
| 526 LOG(INFO) << "no request handler found"; |
| 521 } | 527 } |
| 522 | 528 |
| 523 void ServiceManagerConnectionImpl::OnContextInitialized( | 529 void ServiceManagerConnectionImpl::OnContextInitialized( |
| 524 const service_manager::Identity& identity) { | 530 const service_manager::Identity& identity) { |
| 525 identity_ = identity; | 531 identity_ = identity; |
| 526 if (!initialize_handler_.is_null()) | 532 if (!initialize_handler_.is_null()) |
| 527 base::ResetAndReturn(&initialize_handler_).Run(); | 533 base::ResetAndReturn(&initialize_handler_).Run(); |
| 528 } | 534 } |
| 529 | 535 |
| 530 void ServiceManagerConnectionImpl::OnConnectionLost() { | 536 void ServiceManagerConnectionImpl::OnConnectionLost() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 541 } | 547 } |
| 542 | 548 |
| 543 void ServiceManagerConnectionImpl::GetInterface( | 549 void ServiceManagerConnectionImpl::GetInterface( |
| 544 service_manager::mojom::InterfaceProvider* provider, | 550 service_manager::mojom::InterfaceProvider* provider, |
| 545 const std::string& interface_name, | 551 const std::string& interface_name, |
| 546 mojo::ScopedMessagePipeHandle request_handle) { | 552 mojo::ScopedMessagePipeHandle request_handle) { |
| 547 provider->GetInterface(interface_name, std::move(request_handle)); | 553 provider->GetInterface(interface_name, std::move(request_handle)); |
| 548 } | 554 } |
| 549 | 555 |
| 550 } // namespace content | 556 } // namespace content |
| 551 | |
| OLD | NEW |