| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/mediasession/MediaMetadata.h" | 5 #include "modules/mediasession/MediaMetadata.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "modules/mediasession/MediaImage.h" | 11 #include "modules/mediasession/MediaImage.h" |
| 11 #include "modules/mediasession/MediaMetadataInit.h" | 12 #include "modules/mediasession/MediaMetadataInit.h" |
| 12 #include "modules/mediasession/MediaSession.h" | 13 #include "modules/mediasession/MediaSession.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 MediaMetadata* MediaMetadata::create(ScriptState* scriptState, | 18 MediaMetadata* MediaMetadata::create(ScriptState* scriptState, |
| 18 const MediaMetadataInit& metadata, | 19 const MediaMetadataInit& metadata, |
| 19 ExceptionState& exceptionState) { | 20 ExceptionState& exceptionState) { |
| 20 return new MediaMetadata(scriptState, metadata, exceptionState); | 21 return new MediaMetadata(scriptState, metadata, exceptionState); |
| 21 } | 22 } |
| 22 | 23 |
| 23 MediaMetadata::MediaMetadata(ScriptState* scriptState, | 24 MediaMetadata::MediaMetadata(ScriptState* scriptState, |
| 24 const MediaMetadataInit& metadata, | 25 const MediaMetadataInit& metadata, |
| 25 ExceptionState& exceptionState) | 26 ExceptionState& exceptionState) |
| 26 : m_notifySessionTimer(this, &MediaMetadata::notifySessionTimerFired) { | 27 : m_notifySessionTimer( |
| 28 TaskRunnerHelper::get(TaskType::MiscPlatformAPI, scriptState), |
| 29 this, |
| 30 &MediaMetadata::notifySessionTimerFired) { |
| 27 m_title = metadata.title(); | 31 m_title = metadata.title(); |
| 28 m_artist = metadata.artist(); | 32 m_artist = metadata.artist(); |
| 29 m_album = metadata.album(); | 33 m_album = metadata.album(); |
| 30 setArtworkInternal(scriptState, metadata.artwork(), exceptionState); | 34 setArtworkInternal(scriptState, metadata.artwork(), exceptionState); |
| 31 } | 35 } |
| 32 | 36 |
| 33 String MediaMetadata::title() const { | 37 String MediaMetadata::title() const { |
| 34 return m_title; | 38 return m_title; |
| 35 } | 39 } |
| 36 | 40 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 DCHECK(!exceptionState.hadException()); | 118 DCHECK(!exceptionState.hadException()); |
| 115 m_artwork.swap(processedArtwork); | 119 m_artwork.swap(processedArtwork); |
| 116 } | 120 } |
| 117 | 121 |
| 118 DEFINE_TRACE(MediaMetadata) { | 122 DEFINE_TRACE(MediaMetadata) { |
| 119 visitor->trace(m_artwork); | 123 visitor->trace(m_artwork); |
| 120 visitor->trace(m_session); | 124 visitor->trace(m_session); |
| 121 } | 125 } |
| 122 | 126 |
| 123 } // namespace blink | 127 } // namespace blink |
| OLD | NEW |