OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/webrtc_internals.h" | 5 #include "content/browser/media/webrtc_internals.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/browser/media/webrtc_internals_ui_observer.h" | 9 #include "content/browser/media/webrtc_internals_ui_observer.h" |
10 #include "content/browser/web_contents/web_contents_view.h" | 10 #include "content/browser/web_contents/web_contents_view.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
15 #include "content/public/browser/power_save_blocker.h" | 15 #include "content/public/browser/power_save_blocker.h" |
16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 | 18 |
19 using base::ProcessId; | 19 using base::ProcessId; |
20 using std::string; | 20 using std::string; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 namespace { | 24 namespace { |
| 25 |
| 26 static base::LazyInstance<WebRTCInternals>::Leaky g_webrtc_internals = |
| 27 LAZY_INSTANCE_INITIALIZER; |
| 28 |
25 // Makes sure that |dict| has a ListValue under path "log". | 29 // Makes sure that |dict| has a ListValue under path "log". |
26 static base::ListValue* EnsureLogList(base::DictionaryValue* dict) { | 30 static base::ListValue* EnsureLogList(base::DictionaryValue* dict) { |
27 base::ListValue* log = NULL; | 31 base::ListValue* log = NULL; |
28 if (!dict->GetList("log", &log)) { | 32 if (!dict->GetList("log", &log)) { |
29 log = new base::ListValue(); | 33 log = new base::ListValue(); |
30 if (log) | 34 if (log) |
31 dict->Set("log", log); | 35 dict->Set("log", log); |
32 } | 36 } |
33 return log; | 37 return log; |
34 } | 38 } |
(...skipping 19 matching lines...) Expand all Loading... |
54 aec_dump_file_path_ = | 58 aec_dump_file_path_ = |
55 aec_dump_file_path_.Append(FILE_PATH_LITERAL("audio.aecdump")); | 59 aec_dump_file_path_.Append(FILE_PATH_LITERAL("audio.aecdump")); |
56 } | 60 } |
57 #endif // defined(ENABLE_WEBRTC) | 61 #endif // defined(ENABLE_WEBRTC) |
58 } | 62 } |
59 | 63 |
60 WebRTCInternals::~WebRTCInternals() { | 64 WebRTCInternals::~WebRTCInternals() { |
61 } | 65 } |
62 | 66 |
63 WebRTCInternals* WebRTCInternals::GetInstance() { | 67 WebRTCInternals* WebRTCInternals::GetInstance() { |
64 return Singleton<WebRTCInternals>::get(); | 68 return g_webrtc_internals.Pointer(); |
65 } | 69 } |
66 | 70 |
67 void WebRTCInternals::OnAddPeerConnection(int render_process_id, | 71 void WebRTCInternals::OnAddPeerConnection(int render_process_id, |
68 ProcessId pid, | 72 ProcessId pid, |
69 int lid, | 73 int lid, |
70 const string& url, | 74 const string& url, |
71 const string& rtc_configuration, | 75 const string& rtc_configuration, |
72 const string& constraints) { | 76 const string& constraints) { |
73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
74 | 78 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { | 378 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { |
375 DVLOG(1) << ("Preventing the application from being suspended while one or " | 379 DVLOG(1) << ("Preventing the application from being suspended while one or " |
376 "more PeerConnections are active."); | 380 "more PeerConnections are active."); |
377 power_save_blocker_ = content::PowerSaveBlocker::Create( | 381 power_save_blocker_ = content::PowerSaveBlocker::Create( |
378 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 382 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
379 "WebRTC has active PeerConnections.").Pass(); | 383 "WebRTC has active PeerConnections.").Pass(); |
380 } | 384 } |
381 } | 385 } |
382 | 386 |
383 } // namespace content | 387 } // namespace content |
OLD | NEW |