| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/media/media_internals.h" | 5 #include "content/browser/media/media_internals.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "media/base/audio_parameters.h" | 26 #include "media/base/audio_parameters.h" |
| 27 #include "media/base/media_log_event.h" | 27 #include "media/base/media_log_event.h" |
| 28 #include "media/filters/gpu_video_decoder.h" | 28 #include "media/filters/gpu_video_decoder.h" |
| 29 | 29 |
| 30 #if !defined(OS_ANDROID) | 30 #if !defined(OS_ANDROID) |
| 31 #include "media/filters/decrypting_video_decoder.h" | 31 #include "media/filters/decrypting_video_decoder.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 static base::LazyInstance<content::MediaInternals>::Leaky g_media_internals = | |
| 37 LAZY_INSTANCE_INITIALIZER; | |
| 38 | |
| 39 base::string16 SerializeUpdate(const std::string& function, | 36 base::string16 SerializeUpdate(const std::string& function, |
| 40 const base::Value* value) { | 37 const base::Value* value) { |
| 41 return content::WebUI::GetJavascriptCall( | 38 return content::WebUI::GetJavascriptCall( |
| 42 function, std::vector<const base::Value*>(1, value)); | 39 function, std::vector<const base::Value*>(1, value)); |
| 43 } | 40 } |
| 44 | 41 |
| 45 std::string EffectsToString(int effects) { | 42 std::string EffectsToString(int effects) { |
| 46 if (effects == media::AudioParameters::NO_EFFECTS) | 43 if (effects == media::AudioParameters::NO_EFFECTS) |
| 47 return "NO_EFFECTS"; | 44 return "NO_EFFECTS"; |
| 48 | 45 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 while (it != players_it->second.end()) { | 586 while (it != players_it->second.end()) { |
| 590 ReportUMAForPipelineStatus(it->second); | 587 ReportUMAForPipelineStatus(it->second); |
| 591 FinalizeWatchTime(it->second.has_video, &(it->second.watch_time_info), | 588 FinalizeWatchTime(it->second.has_video, &(it->second.watch_time_info), |
| 592 FinalizeType::EVERYTHING); | 589 FinalizeType::EVERYTHING); |
| 593 players_it->second.erase(it++); | 590 players_it->second.erase(it++); |
| 594 } | 591 } |
| 595 renderer_info_.erase(players_it); | 592 renderer_info_.erase(players_it); |
| 596 } | 593 } |
| 597 | 594 |
| 598 MediaInternals* MediaInternals::GetInstance() { | 595 MediaInternals* MediaInternals::GetInstance() { |
| 599 return g_media_internals.Pointer(); | 596 static content::MediaInternals* internals = new content::MediaInternals(); |
| 597 return internals; |
| 600 } | 598 } |
| 601 | 599 |
| 602 MediaInternals::MediaInternals() | 600 MediaInternals::MediaInternals() |
| 603 : can_update_(false), | 601 : can_update_(false), |
| 604 owner_ids_(), | 602 owner_ids_(), |
| 605 uma_handler_(new MediaInternalsUMAHandler()) { | 603 uma_handler_(new MediaInternalsUMAHandler()) { |
| 606 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 604 registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 607 NotificationService::AllBrowserContextsAndSources()); | 605 NotificationService::AllBrowserContextsAndSources()); |
| 608 } | 606 } |
| 609 | 607 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); | 844 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); |
| 847 existing_dict->MergeDictionary(value); | 845 existing_dict->MergeDictionary(value); |
| 848 } | 846 } |
| 849 } | 847 } |
| 850 | 848 |
| 851 if (CanUpdate()) | 849 if (CanUpdate()) |
| 852 SendUpdate(SerializeUpdate(function, value)); | 850 SendUpdate(SerializeUpdate(function, value)); |
| 853 } | 851 } |
| 854 | 852 |
| 855 } // namespace content | 853 } // namespace content |
| OLD | NEW |