Chromium Code Reviews| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 DCHECK(is_running_in_process_); | 224 DCHECK(is_running_in_process_); |
| 225 // Duplicate the file handle for in process mode so this function | 225 // Duplicate the file handle for in process mode so this function |
| 226 // has the same semantics for both in process mode and out of | 226 // has the same semantics for both in process mode and out of |
| 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 | |
| 235 RendererPpapiHostImpl::ShareSharedMemoryHandleWithRemote( | |
| 236 const base::SharedMemoryHandle& handle) { | |
| 237 base::PlatformFile local_platform_file = | |
| 238 #if defined(OS_POSIX) | |
| 239 handle.fd; | |
| 240 #elif defined(OS_WIN) | |
| 241 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); | |
|
piman
2015/06/01 22:16:08
ditto, no need for casts.
erikchen
2015/06/01 23:48:53
Done.
| |
| 242 #else | |
| 243 #error Not implemented. | |
| 244 #endif | |
| 245 return ShareHandleWithRemote(local_platform_file, false); | |
| 246 } | |
| 247 | |
| 234 bool RendererPpapiHostImpl::IsRunningInProcess() const { | 248 bool RendererPpapiHostImpl::IsRunningInProcess() const { |
| 235 return is_running_in_process_; | 249 return is_running_in_process_; |
| 236 } | 250 } |
| 237 | 251 |
| 238 std::string RendererPpapiHostImpl::GetPluginName() const { | 252 std::string RendererPpapiHostImpl::GetPluginName() const { |
| 239 return module_->name(); | 253 return module_->name(); |
| 240 } | 254 } |
| 241 | 255 |
| 242 void RendererPpapiHostImpl::SetToExternalPluginHost() { | 256 void RendererPpapiHostImpl::SetToExternalPluginHost() { |
| 243 is_external_plugin_host_ = true; | 257 is_external_plugin_host_ = true; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 272 PepperPluginInstanceImpl* instance = | 286 PepperPluginInstanceImpl* instance = |
| 273 HostGlobals::Get()->GetInstance(pp_instance); | 287 HostGlobals::Get()->GetInstance(pp_instance); |
| 274 if (!instance) | 288 if (!instance) |
| 275 return NULL; | 289 return NULL; |
| 276 if (!instance->IsValidInstanceOf(module_)) | 290 if (!instance->IsValidInstanceOf(module_)) |
| 277 return NULL; | 291 return NULL; |
| 278 return instance; | 292 return instance; |
| 279 } | 293 } |
| 280 | 294 |
| 281 } // namespace content | 295 } // namespace content |
| OLD | NEW |