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

Side by Side Diff: media/mojo/common/mojo_decoder_buffer_converter.cc

Issue 2623263005: Tag some of Mojo heap allocations for the heap profiler. (Closed)
Patch Set: Synced Created 3 years, 10 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 | « ipc/ipc_sync_channel.cc ('k') | media/remoting/demuxer_stream_adapter.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mojo/common/mojo_decoder_buffer_converter.h" 5 #include "media/mojo/common/mojo_decoder_buffer_converter.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 mojo::ScopedDataPipeProducerHandle* producer_handle) { 56 mojo::ScopedDataPipeProducerHandle* producer_handle) {
57 DVLOG(1) << __func__; 57 DVLOG(1) << __func__;
58 std::unique_ptr<mojo::DataPipe> data_pipe = CreateDataPipe(type); 58 std::unique_ptr<mojo::DataPipe> data_pipe = CreateDataPipe(type);
59 *producer_handle = std::move(data_pipe->producer_handle); 59 *producer_handle = std::move(data_pipe->producer_handle);
60 return base::WrapUnique( 60 return base::WrapUnique(
61 new MojoDecoderBufferReader(std::move(data_pipe->consumer_handle))); 61 new MojoDecoderBufferReader(std::move(data_pipe->consumer_handle)));
62 } 62 }
63 63
64 MojoDecoderBufferReader::MojoDecoderBufferReader( 64 MojoDecoderBufferReader::MojoDecoderBufferReader(
65 mojo::ScopedDataPipeConsumerHandle consumer_handle) 65 mojo::ScopedDataPipeConsumerHandle consumer_handle)
66 : consumer_handle_(std::move(consumer_handle)), bytes_read_(0) { 66 : consumer_handle_(std::move(consumer_handle)),
67 pipe_watcher_(FROM_HERE),
68 bytes_read_(0) {
67 DVLOG(1) << __func__; 69 DVLOG(1) << __func__;
68 70
69 MojoResult result = 71 MojoResult result =
70 pipe_watcher_.Start(consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE, 72 pipe_watcher_.Start(consumer_handle_.get(), MOJO_HANDLE_SIGNAL_READABLE,
71 base::Bind(&MojoDecoderBufferReader::OnPipeReadable, 73 base::Bind(&MojoDecoderBufferReader::OnPipeReadable,
72 base::Unretained(this))); 74 base::Unretained(this)));
73 if (result != MOJO_RESULT_OK) { 75 if (result != MOJO_RESULT_OK) {
74 DVLOG(1) << __func__ 76 DVLOG(1) << __func__
75 << ": Failed to start watching the pipe. result=" << result; 77 << ": Failed to start watching the pipe. result=" << result;
76 consumer_handle_.reset(); 78 consumer_handle_.reset();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 mojo::ScopedDataPipeConsumerHandle* consumer_handle) { 178 mojo::ScopedDataPipeConsumerHandle* consumer_handle) {
177 DVLOG(1) << __func__; 179 DVLOG(1) << __func__;
178 std::unique_ptr<mojo::DataPipe> data_pipe = CreateDataPipe(type); 180 std::unique_ptr<mojo::DataPipe> data_pipe = CreateDataPipe(type);
179 *consumer_handle = std::move(data_pipe->consumer_handle); 181 *consumer_handle = std::move(data_pipe->consumer_handle);
180 return base::WrapUnique( 182 return base::WrapUnique(
181 new MojoDecoderBufferWriter(std::move(data_pipe->producer_handle))); 183 new MojoDecoderBufferWriter(std::move(data_pipe->producer_handle)));
182 } 184 }
183 185
184 MojoDecoderBufferWriter::MojoDecoderBufferWriter( 186 MojoDecoderBufferWriter::MojoDecoderBufferWriter(
185 mojo::ScopedDataPipeProducerHandle producer_handle) 187 mojo::ScopedDataPipeProducerHandle producer_handle)
186 : producer_handle_(std::move(producer_handle)), bytes_written_(0) { 188 : producer_handle_(std::move(producer_handle)),
189 pipe_watcher_(FROM_HERE),
190 bytes_written_(0) {
187 DVLOG(1) << __func__; 191 DVLOG(1) << __func__;
188 192
189 MojoResult result = 193 MojoResult result =
190 pipe_watcher_.Start(producer_handle_.get(), MOJO_HANDLE_SIGNAL_WRITABLE, 194 pipe_watcher_.Start(producer_handle_.get(), MOJO_HANDLE_SIGNAL_WRITABLE,
191 base::Bind(&MojoDecoderBufferWriter::OnPipeWritable, 195 base::Bind(&MojoDecoderBufferWriter::OnPipeWritable,
192 base::Unretained(this))); 196 base::Unretained(this)));
193 if (result != MOJO_RESULT_OK) { 197 if (result != MOJO_RESULT_OK) {
194 DVLOG(1) << __func__ 198 DVLOG(1) << __func__
195 << ": Failed to start watching the pipe. result=" << result; 199 << ": Failed to start watching the pipe. result=" << result;
196 producer_handle_.reset(); 200 producer_handle_.reset();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 if (bytes_written_ == buffer_size) { 279 if (bytes_written_ == buffer_size) {
276 media_buffer_ = nullptr; 280 media_buffer_ = nullptr;
277 bytes_written_ = 0; 281 bytes_written_ = 0;
278 } 282 }
279 } 283 }
280 284
281 return result; 285 return result;
282 } 286 }
283 287
284 } // namespace media 288 } // namespace media
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.cc ('k') | media/remoting/demuxer_stream_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698