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

Unified Diff: content/renderer/media/render_media_client.cc

Issue 2712983004: Simplify/Cleanup MediaClient (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/render_media_client.cc
diff --git a/content/renderer/media/render_media_client.cc b/content/renderer/media/render_media_client.cc
deleted file mode 100644
index d916fe2c59c84474110ccbe4090f725e3854e750..0000000000000000000000000000000000000000
--- a/content/renderer/media/render_media_client.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/media/render_media_client.h"
-
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/time/default_tick_clock.h"
-#include "content/public/common/content_client.h"
-#include "content/public/renderer/content_renderer_client.h"
-#include "media/base/media_switches.h"
-#include "media/base/video_color_space.h"
-#include "ui/display/display_switches.h"
-
-namespace content {
-
-void RenderMediaClient::Initialize() {
- GetInstance();
-}
-
-RenderMediaClient::RenderMediaClient()
- : has_updated_(false),
- is_update_needed_(true),
- tick_clock_(new base::DefaultTickClock()) {
- media::SetMediaClient(this);
-}
-
-RenderMediaClient::~RenderMediaClient() {
-}
-
-void RenderMediaClient::AddKeySystemsInfoForUMA(
- std::vector<media::KeySystemInfoForUMA>* key_systems_info_for_uma) {
- DVLOG(2) << __func__;
-#if defined(WIDEVINE_CDM_AVAILABLE)
- key_systems_info_for_uma->push_back(media::KeySystemInfoForUMA(
- kWidevineKeySystem, kWidevineKeySystemNameForUMA));
-#endif // WIDEVINE_CDM_AVAILABLE
-}
-
-bool RenderMediaClient::IsKeySystemsUpdateNeeded() {
- DVLOG(2) << __func__;
- DCHECK(thread_checker_.CalledOnValidThread());
-
- // Always needs update if we have never updated, regardless the
- // |last_update_time_ticks_|'s initial value.
- if (!has_updated_) {
- DCHECK(is_update_needed_);
- return true;
- }
-
- if (!is_update_needed_)
- return false;
-
- // The update could be expensive. For example, it could involve a sync IPC to
- // the browser process. Use a minimum update interval to avoid unnecessarily
- // frequent update.
- static const int kMinUpdateIntervalInMilliseconds = 1000;
- if ((tick_clock_->NowTicks() - last_update_time_ticks_).InMilliseconds() <
- kMinUpdateIntervalInMilliseconds) {
- return false;
- }
-
- return true;
-}
-
-void RenderMediaClient::AddSupportedKeySystems(
- std::vector<std::unique_ptr<media::KeySystemProperties>>*
- key_systems_properties) {
- DVLOG(2) << __func__;
- DCHECK(thread_checker_.CalledOnValidThread());
-
- GetContentClient()->renderer()->AddSupportedKeySystems(
- key_systems_properties);
-
- has_updated_ = true;
- last_update_time_ticks_ = tick_clock_->NowTicks();
-
- // Check whether all potentially supported key systems are supported. If so,
- // no need to update again.
-#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
- for (const auto& properties : *key_systems_properties) {
- if (properties->GetKeySystemName() == kWidevineKeySystem)
- is_update_needed_ = false;
- }
-#else
- is_update_needed_ = false;
-#endif
-}
-
-void RenderMediaClient::RecordRapporURL(const std::string& metric,
- const GURL& url) {
- GetContentClient()->renderer()->RecordRapporURL(metric, url);
-}
-
-bool RenderMediaClient::IsSupportedVideoConfig(
- const media::VideoConfig& config) {
- // Render media client does not customize decoder support. Defer to media/.
- return ::media::IsSupportedVideoConfig(config);
-}
-
-void RenderMediaClient::SetTickClockForTesting(
- std::unique_ptr<base::TickClock> tick_clock) {
- tick_clock_.swap(tick_clock);
-}
-
-// static
-RenderMediaClient* RenderMediaClient::GetInstance() {
- static RenderMediaClient* client = new RenderMediaClient();
- return client;
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698