| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 #if defined(OS_POSIX) | 125 #if defined(OS_POSIX) |
| 126 mojo::edk::ScopedPlatformHandle CreateServerHandle( | 126 mojo::edk::ScopedPlatformHandle CreateServerHandle( |
| 127 const IPC::ChannelHandle& channel_handle) { | 127 const IPC::ChannelHandle& channel_handle) { |
| 128 #if defined(OS_MACOSX) | 128 #if defined(OS_MACOSX) |
| 129 mojo::edk::PlatformHandle platform_handle(channel_handle.socket.fd); | 129 mojo::edk::PlatformHandle platform_handle(channel_handle.socket.fd); |
| 130 platform_handle.needs_connection = true; | 130 platform_handle.needs_connection = true; |
| 131 return mojo::edk::ScopedPlatformHandle(platform_handle); | 131 return mojo::edk::ScopedPlatformHandle(platform_handle); |
| 132 #else | 132 #else |
| 133 return mojo::edk::CreateServerHandle( | 133 return mojo::edk::CreateServerHandle( |
| 134 mojo::edk::NamedPlatformHandle(channel_handle.name), false); | 134 mojo::edk::NamedPlatformHandle(channel_handle.name)); |
| 135 #endif | 135 #endif |
| 136 } | 136 } |
| 137 #endif | 137 #endif |
| 138 | 138 |
| 139 } // namespace | 139 } // namespace |
| 140 | 140 |
| 141 ServiceProcess::ServiceProcess() | 141 ServiceProcess::ServiceProcess() |
| 142 : shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, | 142 : shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 143 base::WaitableEvent::InitialState::NOT_SIGNALED), | 143 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 144 main_message_loop_(NULL), | 144 main_message_loop_(NULL), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 server_handle_ = mojo::edk::NamedPlatformHandle( | 327 server_handle_ = mojo::edk::NamedPlatformHandle( |
| 328 service_process_state_->GetServiceProcessChannel().name); | 328 service_process_state_->GetServiceProcessChannel().name); |
| 329 #endif | 329 #endif |
| 330 DCHECK(server_handle_.is_valid()); | 330 DCHECK(server_handle_.is_valid()); |
| 331 } | 331 } |
| 332 | 332 |
| 333 mojo::edk::ScopedPlatformHandle channel_handle; | 333 mojo::edk::ScopedPlatformHandle channel_handle; |
| 334 #if defined(OS_POSIX) | 334 #if defined(OS_POSIX) |
| 335 channel_handle = mojo::edk::DuplicatePlatformHandle(server_handle_.get()); | 335 channel_handle = mojo::edk::DuplicatePlatformHandle(server_handle_.get()); |
| 336 #elif defined(OS_WIN) | 336 #elif defined(OS_WIN) |
| 337 channel_handle = mojo::edk::CreateServerHandle(server_handle_, false); | 337 mojo::edk::CreateServerHandleOptions options; |
| 338 options.enforce_uniqueness = false; |
| 339 channel_handle = mojo::edk::CreateServerHandle(server_handle_, options); |
| 338 #endif | 340 #endif |
| 339 CHECK(channel_handle.is_valid()); | 341 CHECK(channel_handle.is_valid()); |
| 340 | 342 |
| 341 return mojo::edk::ConnectToPeerProcess(std::move(channel_handle)); | 343 return mojo::edk::ConnectToPeerProcess(std::move(channel_handle)); |
| 342 } | 344 } |
| 343 | 345 |
| 344 cloud_print::CloudPrintProxy* ServiceProcess::GetCloudPrintProxy() { | 346 cloud_print::CloudPrintProxy* ServiceProcess::GetCloudPrintProxy() { |
| 345 if (!cloud_print_proxy_.get()) { | 347 if (!cloud_print_proxy_.get()) { |
| 346 cloud_print_proxy_.reset(new cloud_print::CloudPrintProxy()); | 348 cloud_print_proxy_.reset(new cloud_print::CloudPrintProxy()); |
| 347 cloud_print_proxy_->Initialize(service_prefs_.get(), this); | 349 cloud_print_proxy_->Initialize(service_prefs_.get(), this); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } else { | 418 } else { |
| 417 Shutdown(); | 419 Shutdown(); |
| 418 } | 420 } |
| 419 } | 421 } |
| 420 } | 422 } |
| 421 | 423 |
| 422 ServiceProcess::~ServiceProcess() { | 424 ServiceProcess::~ServiceProcess() { |
| 423 Teardown(); | 425 Teardown(); |
| 424 g_service_process = NULL; | 426 g_service_process = NULL; |
| 425 } | 427 } |
| OLD | NEW |