Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: media/base/video_frame.cc

Issue 2849633002: Get rid of base::SharedMemory::NULLHandle(); (Closed)
Patch Set: Rebase. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/client/gpu_channel_host.cc ('k') | media/capture/content/thread_safe_capture_oracle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData( 224 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData(
225 VideoPixelFormat format, 225 VideoPixelFormat format,
226 const gfx::Size& coded_size, 226 const gfx::Size& coded_size,
227 const gfx::Rect& visible_rect, 227 const gfx::Rect& visible_rect,
228 const gfx::Size& natural_size, 228 const gfx::Size& natural_size,
229 uint8_t* data, 229 uint8_t* data,
230 size_t data_size, 230 size_t data_size,
231 base::TimeDelta timestamp) { 231 base::TimeDelta timestamp) {
232 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size, 232 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size,
233 visible_rect, natural_size, data, data_size, 233 visible_rect, natural_size, data, data_size,
234 timestamp, base::SharedMemory::NULLHandle(), 0); 234 timestamp, base::SharedMemoryHandle(), 0);
235 } 235 }
236 236
237 // static 237 // static
238 scoped_refptr<VideoFrame> VideoFrame::WrapExternalSharedMemory( 238 scoped_refptr<VideoFrame> VideoFrame::WrapExternalSharedMemory(
239 VideoPixelFormat format, 239 VideoPixelFormat format,
240 const gfx::Size& coded_size, 240 const gfx::Size& coded_size,
241 const gfx::Rect& visible_rect, 241 const gfx::Rect& visible_rect,
242 const gfx::Size& natural_size, 242 const gfx::Size& natural_size,
243 uint8_t* data, 243 uint8_t* data,
244 size_t data_size, 244 size_t data_size,
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 StorageType storage_type, 918 StorageType storage_type,
919 const gfx::Size& coded_size, 919 const gfx::Size& coded_size,
920 const gfx::Rect& visible_rect, 920 const gfx::Rect& visible_rect,
921 const gfx::Size& natural_size, 921 const gfx::Size& natural_size,
922 base::TimeDelta timestamp) 922 base::TimeDelta timestamp)
923 : format_(format), 923 : format_(format),
924 storage_type_(storage_type), 924 storage_type_(storage_type),
925 coded_size_(coded_size), 925 coded_size_(coded_size),
926 visible_rect_(visible_rect), 926 visible_rect_(visible_rect),
927 natural_size_(natural_size), 927 natural_size_(natural_size),
928 shared_memory_handle_(base::SharedMemory::NULLHandle()),
929 shared_memory_offset_(0), 928 shared_memory_offset_(0),
930 timestamp_(timestamp), 929 timestamp_(timestamp),
931 unique_id_(g_unique_id_generator.GetNext()) { 930 unique_id_(g_unique_id_generator.GetNext()) {
932 DCHECK(IsValidConfig(format_, storage_type, coded_size_, visible_rect_, 931 DCHECK(IsValidConfig(format_, storage_type, coded_size_, visible_rect_,
933 natural_size_)); 932 natural_size_));
934 memset(&mailbox_holders_, 0, sizeof(mailbox_holders_)); 933 memset(&mailbox_holders_, 0, sizeof(mailbox_holders_));
935 memset(&strides_, 0, sizeof(strides_)); 934 memset(&strides_, 0, sizeof(strides_));
936 memset(&data_, 0, sizeof(data_)); 935 memset(&data_, 0, sizeof(data_));
937 } 936 }
938 937
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 if (zero_initialize_memory) 1205 if (zero_initialize_memory)
1207 memset(data, 0, data_size); 1206 memset(data, 0, data_size);
1208 1207
1209 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1208 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1210 data_[plane] = data + offset[plane]; 1209 data_[plane] = data + offset[plane];
1211 1210
1212 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1211 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1213 } 1212 }
1214 1213
1215 } // namespace media 1214 } // namespace media
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_channel_host.cc ('k') | media/capture/content/thread_safe_capture_oracle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698