OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_media_stream_track_host_base.h" | 5 #include "content/renderer/pepper/pepper_media_stream_track_host_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
9 #include "content/common/pepper_file_util.h" | 9 #include "content/common/pepper_file_util.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return false; | 56 return false; |
57 | 57 |
58 base::SharedMemoryHandle shm_handle = shm->handle(); | 58 base::SharedMemoryHandle shm_handle = shm->handle(); |
59 if (!buffer_manager_.SetBuffers(number_of_buffers, | 59 if (!buffer_manager_.SetBuffers(number_of_buffers, |
60 buffer_size_aligned.ValueOrDie(), | 60 buffer_size_aligned.ValueOrDie(), |
61 shm.Pass(), | 61 shm.Pass(), |
62 true)) { | 62 true)) { |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 base::PlatformFile platform_file = | 66 SerializedHandle handle(host_->ShareSharedMemoryHandleWithRemote(shm_handle), |
67 PlatformFileFromSharedMemoryHandle(shm_handle); | |
68 SerializedHandle handle(host_->ShareHandleWithRemote(platform_file, false), | |
69 size.ValueOrDie()); | 67 size.ValueOrDie()); |
70 bool readonly = (track_type == kRead); | 68 bool readonly = (track_type == kRead); |
71 host()->SendUnsolicitedReplyWithHandles( | 69 host()->SendUnsolicitedReplyWithHandles( |
72 pp_resource(), | 70 pp_resource(), |
73 PpapiPluginMsg_MediaStreamTrack_InitBuffers( | 71 PpapiPluginMsg_MediaStreamTrack_InitBuffers( |
74 number_of_buffers, | 72 number_of_buffers, |
75 buffer_size_aligned.ValueOrDie(), | 73 buffer_size_aligned.ValueOrDie(), |
76 readonly), | 74 readonly), |
77 std::vector<SerializedHandle>(1, handle)); | 75 std::vector<SerializedHandle>(1, handle)); |
78 return true; | 76 return true; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return PP_OK; | 110 return PP_OK; |
113 } | 111 } |
114 | 112 |
115 int32_t PepperMediaStreamTrackHostBase::OnHostMsgClose( | 113 int32_t PepperMediaStreamTrackHostBase::OnHostMsgClose( |
116 HostMessageContext* context) { | 114 HostMessageContext* context) { |
117 OnClose(); | 115 OnClose(); |
118 return PP_OK; | 116 return PP_OK; |
119 } | 117 } |
120 | 118 |
121 } // namespace content | 119 } // namespace content |
OLD | NEW |