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/pepper_video_capture_host.h" | 5 #include "content/renderer/pepper/pepper_video_capture_host.h" |
6 | 6 |
7 #include "ppapi/host/dispatch_host_message.h" | 7 #include "ppapi/host/dispatch_host_message.h" |
8 #include "ppapi/host/ppapi_host.h" | 8 #include "ppapi/host/ppapi_host.h" |
9 #include "ppapi/proxy/host_dispatcher.h" | 9 #include "ppapi/proxy/host_dispatcher.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
11 #include "ppapi/shared_impl/host_resource.h" | 11 #include "ppapi/shared_impl/host_resource.h" |
12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
13 #include "ppapi/thunk/ppb_buffer_api.h" | 13 #include "ppapi/thunk/ppb_buffer_api.h" |
14 #include "webkit/plugins/ppapi/host_globals.h" | 14 #include "webkit/plugins/ppapi/host_globals.h" |
15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 15 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
16 | 16 |
17 using ppapi::HostResource; | 17 using ppapi::HostResource; |
18 using ppapi::TrackedCallback; | 18 using ppapi::TrackedCallback; |
19 using ppapi::thunk::EnterResourceNoLock; | 19 using ppapi::thunk::EnterResourceNoLock; |
20 using ppapi::thunk::PPB_Buffer_API; | 20 using ppapi::thunk::PPB_Buffer_API; |
21 using ppapi::thunk::PPB_BufferTrusted_API; | |
22 using webkit::ppapi::HostGlobals; | 21 using webkit::ppapi::HostGlobals; |
23 using webkit::ppapi::PPB_Buffer_Impl; | 22 using webkit::ppapi::PPB_Buffer_Impl; |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 // Maximum number of buffers to actually allocate. | 26 // Maximum number of buffers to actually allocate. |
28 const uint32_t kMaxBuffers = 20; | 27 const uint32_t kMaxBuffers = 20; |
29 | 28 |
30 } // namespace | 29 } // namespace |
31 | 30 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 host_resource.SetHostResource(pp_instance(), res); | 195 host_resource.SetHostResource(pp_instance(), res); |
197 buffer_host_resources.push_back(host_resource); | 196 buffer_host_resources.push_back(host_resource); |
198 | 197 |
199 // Add a reference for the plugin, which is resposible for releasing it. | 198 // Add a reference for the plugin, which is resposible for releasing it. |
200 tracker->AddRefResource(res); | 199 tracker->AddRefResource(res); |
201 } | 200 } |
202 | 201 |
203 // Add the serialized shared memory handle to params. FileDescriptor is | 202 // Add the serialized shared memory handle to params. FileDescriptor is |
204 // treated in special case. | 203 // treated in special case. |
205 { | 204 { |
206 EnterResourceNoLock<PPB_BufferTrusted_API> enter(res, true); | 205 EnterResourceNoLock<PPB_Buffer_API> enter(res, true); |
207 DCHECK(enter.succeeded()); | 206 DCHECK(enter.succeeded()); |
208 int handle; | 207 int handle; |
209 int32_t result = enter.object()->GetSharedMemory(&handle); | 208 int32_t result = enter.object()->GetSharedMemory(&handle); |
210 DCHECK(result == PP_OK); | 209 DCHECK(result == PP_OK); |
211 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle, | 210 // TODO(piman/brettw): Change trusted interface to return a PP_FileHandle, |
212 // those casts are ugly. | 211 // those casts are ugly. |
213 base::PlatformFile platform_file = | 212 base::PlatformFile platform_file = |
214 #if defined(OS_WIN) | 213 #if defined(OS_WIN) |
215 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); | 214 reinterpret_cast<HANDLE>(static_cast<intptr_t>(handle)); |
216 #elif defined(OS_POSIX) | 215 #elif defined(OS_POSIX) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 PepperVideoCaptureHost::BufferInfo::BufferInfo() | 417 PepperVideoCaptureHost::BufferInfo::BufferInfo() |
419 : in_use(false), | 418 : in_use(false), |
420 data(NULL), | 419 data(NULL), |
421 buffer() { | 420 buffer() { |
422 } | 421 } |
423 | 422 |
424 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { | 423 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { |
425 } | 424 } |
426 | 425 |
427 } // namespace content | 426 } // namespace content |
OLD | NEW |