OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/mojo/clients/mojo_media_log_service.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 11 #include "media/base/media_log_event.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 MojoMediaLogService::MojoMediaLogService(media::MediaLog* media_log) |
| 16 : media_log_(media_log) { |
| 17 DVLOG(1) << __func__; |
| 18 DCHECK(media_log_); |
| 19 } |
| 20 |
| 21 MojoMediaLogService::~MojoMediaLogService() { |
| 22 DVLOG(1) << __func__; |
| 23 } |
| 24 |
| 25 void MojoMediaLogService::AddEvent(const media::MediaLogEvent& event) { |
| 26 DVLOG(1) << __func__; |
| 27 |
| 28 // Make a copy so that we can transfer ownership to |media_log_|. |
| 29 std::unique_ptr<media::MediaLogEvent> modified_event = |
| 30 base::MakeUnique<media::MediaLogEvent>(event); |
| 31 |
| 32 // |id| is player-unique per-process, but the remote side does not know the |
| 33 // correct value (nor would we necessarily trust it). Overwrite with the |
| 34 // correct value. |
| 35 modified_event->id = media_log_->id(); |
| 36 |
| 37 media_log_->AddEvent(std::move(modified_event)); |
| 38 } |
| 39 |
| 40 } // namespace media |
OLD | NEW |