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

Side by Side Diff: content/common/gpu/media/video_encode_accelerator_unittest.cc

Issue 651253002: Enforce handle ownership in base::Process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add empty line Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/memory_mapped_file.h" 9 #include "base/files/memory_mapped_file.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/process/process.h" 12 #include "base/process/process_handle.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" 16 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h"
17 #include "media/base/bind_to_current_loop.h" 17 #include "media/base/bind_to_current_loop.h"
18 #include "media/base/bitstream_buffer.h" 18 #include "media/base/bitstream_buffer.h"
19 #include "media/base/test_data_util.h" 19 #include "media/base/test_data_util.h"
20 #include "media/filters/h264_parser.h" 20 #include "media/filters/h264_parser.h"
21 #include "media/video/video_encode_accelerator.h" 21 #include "media/video/video_encode_accelerator.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 936 }
937 937
938 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { 938 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) {
939 if (!has_encoder()) 939 if (!has_encoder())
940 return; 940 return;
941 941
942 if (state_ != CS_ENCODING) 942 if (state_ != CS_ENCODING)
943 return; 943 return;
944 944
945 base::SharedMemoryHandle dup_handle; 945 base::SharedMemoryHandle dup_handle;
946 CHECK(shm->ShareToProcess(base::Process::Current().handle(), &dup_handle)); 946 CHECK(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle));
947 947
948 media::BitstreamBuffer bitstream_buffer( 948 media::BitstreamBuffer bitstream_buffer(
949 next_output_buffer_id_++, dup_handle, output_buffer_size_); 949 next_output_buffer_id_++, dup_handle, output_buffer_size_);
950 CHECK(output_buffers_at_client_.insert(std::make_pair(bitstream_buffer.id(), 950 CHECK(output_buffers_at_client_.insert(std::make_pair(bitstream_buffer.id(),
951 shm)).second); 951 shm)).second);
952 encoder_->UseOutputBitstreamBuffer(bitstream_buffer); 952 encoder_->UseOutputBitstreamBuffer(bitstream_buffer);
953 } 953 }
954 954
955 bool VEAClient::HandleEncodedFrame(bool keyframe) { 955 bool VEAClient::HandleEncodedFrame(bool keyframe) {
956 // This would be a bug in the test, which should not ignore false 956 // This would be a bug in the test, which should not ignore false
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1203 }
1204 1204
1205 content::g_env = 1205 content::g_env =
1206 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( 1206 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>(
1207 testing::AddGlobalTestEnvironment( 1207 testing::AddGlobalTestEnvironment(
1208 new content::VideoEncodeAcceleratorTestEnvironment( 1208 new content::VideoEncodeAcceleratorTestEnvironment(
1209 test_stream_data.Pass()))); 1209 test_stream_data.Pass())));
1210 1210
1211 return RUN_ALL_TESTS(); 1211 return RUN_ALL_TESTS();
1212 } 1212 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_decode_accelerator_unittest.cc ('k') | content/public/test/mock_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698