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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 2253943004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « media/cdm/simple_cdm_allocator.cc ('k') | media/formats/mpeg/adts_stream_parser_unittest.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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 size_t min_size) { 694 size_t min_size) {
695 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 695 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
696 if (available_shm_segments_.empty() || 696 if (available_shm_segments_.empty() ||
697 available_shm_segments_.back()->size < min_size) { 697 available_shm_segments_.back()->size < min_size) {
698 size_t size_to_allocate = std::max(min_size, kSharedMemorySegmentBytes); 698 size_t size_to_allocate = std::max(min_size, kSharedMemorySegmentBytes);
699 std::unique_ptr<base::SharedMemory> shm = 699 std::unique_ptr<base::SharedMemory> shm =
700 factories_->CreateSharedMemory(size_to_allocate); 700 factories_->CreateSharedMemory(size_to_allocate);
701 // CreateSharedMemory() can return NULL during Shutdown. 701 // CreateSharedMemory() can return NULL during Shutdown.
702 if (!shm) 702 if (!shm)
703 return NULL; 703 return NULL;
704 return base::WrapUnique(new SHMBuffer(std::move(shm), size_to_allocate)); 704 return base::MakeUnique<SHMBuffer>(std::move(shm), size_to_allocate);
705 } 705 }
706 std::unique_ptr<SHMBuffer> ret(available_shm_segments_.back()); 706 std::unique_ptr<SHMBuffer> ret(available_shm_segments_.back());
707 available_shm_segments_.pop_back(); 707 available_shm_segments_.pop_back();
708 return ret; 708 return ret;
709 } 709 }
710 710
711 void GpuVideoDecoder::PutSHM(std::unique_ptr<SHMBuffer> shm_buffer) { 711 void GpuVideoDecoder::PutSHM(std::unique_ptr<SHMBuffer> shm_buffer) {
712 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 712 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
713 available_shm_segments_.push_back(shm_buffer.release()); 713 available_shm_segments_.push_back(shm_buffer.release());
714 } 714 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 824 }
825 return false; 825 return false;
826 } 826 }
827 827
828 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 828 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
829 const { 829 const {
830 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 830 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
831 } 831 }
832 832
833 } // namespace media 833 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/simple_cdm_allocator.cc ('k') | media/formats/mpeg/adts_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698