| 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 "content/renderer/pepper/renderer_ppapi_host_impl.h" | 5 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // process mode (i.e., the remote side must cloes the handle). | 227 // process mode (i.e., the remote side must cloes the handle). |
| 228 return BrokerGetFileHandleForProcess( | 228 return BrokerGetFileHandleForProcess( |
| 229 handle, base::GetCurrentProcId(), should_close_source); | 229 handle, base::GetCurrentProcId(), should_close_source); |
| 230 } | 230 } |
| 231 return dispatcher_->ShareHandleWithRemote(handle, should_close_source); | 231 return dispatcher_->ShareHandleWithRemote(handle, should_close_source); |
| 232 } | 232 } |
| 233 | 233 |
| 234 base::SharedMemoryHandle | 234 base::SharedMemoryHandle |
| 235 RendererPpapiHostImpl::ShareSharedMemoryHandleWithRemote( | 235 RendererPpapiHostImpl::ShareSharedMemoryHandleWithRemote( |
| 236 const base::SharedMemoryHandle& handle) { | 236 const base::SharedMemoryHandle& handle) { |
| 237 base::PlatformFile local_platform_file = | 237 if (!dispatcher_) { |
| 238 #if defined(OS_POSIX) | 238 DCHECK(is_running_in_process_); |
| 239 handle.fd; | 239 return base::SharedMemory::DuplicateHandle(handle); |
| 240 #elif defined(OS_WIN) | 240 } |
| 241 handle; | 241 return dispatcher_->ShareSharedMemoryHandleWithRemote(handle); |
| 242 #else | |
| 243 #error Not implemented. | |
| 244 #endif | |
| 245 return ShareHandleWithRemote(local_platform_file, false); | |
| 246 } | 242 } |
| 247 | 243 |
| 248 bool RendererPpapiHostImpl::IsRunningInProcess() const { | 244 bool RendererPpapiHostImpl::IsRunningInProcess() const { |
| 249 return is_running_in_process_; | 245 return is_running_in_process_; |
| 250 } | 246 } |
| 251 | 247 |
| 252 std::string RendererPpapiHostImpl::GetPluginName() const { | 248 std::string RendererPpapiHostImpl::GetPluginName() const { |
| 253 return module_->name(); | 249 return module_->name(); |
| 254 } | 250 } |
| 255 | 251 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 286 PepperPluginInstanceImpl* instance = | 282 PepperPluginInstanceImpl* instance = |
| 287 HostGlobals::Get()->GetInstance(pp_instance); | 283 HostGlobals::Get()->GetInstance(pp_instance); |
| 288 if (!instance) | 284 if (!instance) |
| 289 return NULL; | 285 return NULL; |
| 290 if (!instance->IsValidInstanceOf(module_)) | 286 if (!instance->IsValidInstanceOf(module_)) |
| 291 return NULL; | 287 return NULL; |
| 292 return instance; | 288 return instance; |
| 293 } | 289 } |
| 294 | 290 |
| 295 } // namespace content | 291 } // namespace content |
| OLD | NEW |