Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 // This may overwrite an existing entry of |render_process_id| if the | 74 // This may overwrite an existing entry of |render_process_id| if the |
| 75 // previous process crashed and didn't cleanup its child frames. For example, | 75 // previous process crashed and didn't cleanup its child frames. For example, |
| 76 // see FrameTreeBrowserTest.FrameTreeAfterCrash test. | 76 // see FrameTreeBrowserTest.FrameTreeAfterCrash test. |
| 77 g_browser_cdm_manager_map.Get()[render_process_id] = this; | 77 g_browser_cdm_manager_map.Get()[render_process_id] = this; |
| 78 } | 78 } |
| 79 | 79 |
| 80 BrowserCdmManager::~BrowserCdmManager() { | 80 BrowserCdmManager::~BrowserCdmManager() { |
| 81 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 81 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 82 DCHECK(g_browser_cdm_manager_map.Get().count(render_process_id_)); | 82 DCHECK(g_browser_cdm_manager_map.Get().count(render_process_id_)); |
| 83 | 83 |
| 84 g_browser_cdm_manager_map.Get().erase(render_process_id_); | 84 // If an entry of |render_process_id| was overwritten, we shouldn't remove |
| 85 // the entry. For example, see FrameTreeBrowserTest.FrameTreeAfterCrash test, | |
| 86 // and http://crbug.com/430251. | |
| 87 if (g_browser_cdm_manager_map.Get()[render_process_id_] == this) | |
|
Sami
2014/11/18 12:02:25
Should this change be in a different patch? It see
ncarter (slow)
2014/11/18 18:02:53
I believe the fix (which runs some DeleteSoons tha
Jaekyun Seok (inactive)
2014/11/18 22:38:22
Right, this fix exposes the same issue to bug 4302
| |
| 88 g_browser_cdm_manager_map.Get().erase(render_process_id_); | |
| 85 } | 89 } |
| 86 | 90 |
| 87 // Makes sure BrowserCdmManager is always deleted on the Browser UI thread. | 91 // Makes sure BrowserCdmManager is always deleted on the Browser UI thread. |
| 88 void BrowserCdmManager::OnDestruct() const { | 92 void BrowserCdmManager::OnDestruct() const { |
| 89 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 93 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 90 delete this; | 94 delete this; |
| 91 } else { | 95 } else { |
| 92 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); | 96 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); |
| 93 } | 97 } |
| 94 } | 98 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; | 378 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; |
| 375 SendSessionError(render_frame_id, cdm_id, session_id); | 379 SendSessionError(render_frame_id, cdm_id, session_id); |
| 376 return; | 380 return; |
| 377 } | 381 } |
| 378 | 382 |
| 379 // This could fail, in which case a SessionError will be fired. | 383 // This could fail, in which case a SessionError will be fired. |
| 380 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size()); | 384 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size()); |
| 381 } | 385 } |
| 382 | 386 |
| 383 } // namespace content | 387 } // namespace content |
| OLD | NEW |