| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cdm/browser_cdm_manager.h" | 5 #include "content/browser/media/cdm/browser_cdm_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 if (!task_runner_.get()) { | 171 if (!task_runner_.get()) { |
| 172 task_runner_ = | 172 task_runner_ = |
| 173 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); | 173 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 BrowserCdmManager::~BrowserCdmManager() { | 177 BrowserCdmManager::~BrowserCdmManager() { |
| 178 DVLOG(1) << __FUNCTION__ << ": " << render_process_id_; | 178 DVLOG(1) << __FUNCTION__ << ": " << render_process_id_; |
| 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 180 DCHECK(g_browser_cdm_manager_map.Get().count(render_process_id_) == 0); | |
| 181 } | 180 } |
| 182 | 181 |
| 183 // Makes sure BrowserCdmManager is always deleted on the Browser UI thread. | 182 // Makes sure BrowserCdmManager is always deleted on the Browser UI thread. |
| 184 void BrowserCdmManager::OnDestruct() const { | 183 void BrowserCdmManager::OnDestruct() const { |
| 185 DVLOG(1) << __FUNCTION__ << ": " << render_process_id_; | 184 DVLOG(1) << __FUNCTION__ << ": " << render_process_id_; |
| 186 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 185 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 187 delete this; | 186 delete this; |
| 188 } else { | 187 } else { |
| 189 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 188 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| 190 } | 189 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); | 674 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); |
| 676 if (!cdm) { | 675 if (!cdm) { |
| 677 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); | 676 promise->reject(MediaKeys::INVALID_STATE_ERROR, 0, "CDM not found."); |
| 678 return; | 677 return; |
| 679 } | 678 } |
| 680 | 679 |
| 681 cdm->LoadSession(session_type, session_id, promise.Pass()); | 680 cdm->LoadSession(session_type, session_id, promise.Pass()); |
| 682 } | 681 } |
| 683 | 682 |
| 684 } // namespace content | 683 } // namespace content |
| OLD | NEW |