| 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 // MediaFileSystemRegistry implementation. | 5 // MediaFileSystemRegistry implementation. |
| 6 | 6 |
| 7 #include "chrome/browser/media_gallery/media_file_system_registry.h" | 7 #include "chrome/browser/media_gallery/media_file_system_registry.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // interested in. Once all of the RPHs have closed or been terminated a call | 100 // interested in. Once all of the RPHs have closed or been terminated a call |
| 101 // back informs the caller. | 101 // back informs the caller. |
| 102 class RPHReferenceManager : public content::NotificationObserver { | 102 class RPHReferenceManager : public content::NotificationObserver { |
| 103 public: | 103 public: |
| 104 // |no_references_callback| is called when the last RenderViewHost reference | 104 // |no_references_callback| is called when the last RenderViewHost reference |
| 105 // goes away. RenderViewHost references are added through ReferenceFromRVH(). | 105 // goes away. RenderViewHost references are added through ReferenceFromRVH(). |
| 106 explicit RPHReferenceManager(const base::Closure& no_references_callback) | 106 explicit RPHReferenceManager(const base::Closure& no_references_callback) |
| 107 : no_references_callback_(no_references_callback) { | 107 : no_references_callback_(no_references_callback) { |
| 108 } | 108 } |
| 109 | 109 |
| 110 ~RPHReferenceManager() { | 110 virtual ~RPHReferenceManager() { |
| 111 Reset(); | 111 Reset(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Remove all references, but don't call |no_references_callback|. | 114 // Remove all references, but don't call |no_references_callback|. |
| 115 void Reset() { | 115 void Reset() { |
| 116 STLDeleteValues(&refs_); | 116 STLDeleteValues(&refs_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Returns true if there are no references; | 119 // Returns true if there are no references; |
| 120 bool empty() const { | 120 bool empty() const { |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 807 |
| 808 PrefChangeRegistrarMap::iterator pref_it = | 808 PrefChangeRegistrarMap::iterator pref_it = |
| 809 pref_change_registrar_map_.find(profile); | 809 pref_change_registrar_map_.find(profile); |
| 810 DCHECK(pref_it != pref_change_registrar_map_.end()); | 810 DCHECK(pref_it != pref_change_registrar_map_.end()); |
| 811 delete pref_it->second; | 811 delete pref_it->second; |
| 812 pref_change_registrar_map_.erase(pref_it); | 812 pref_change_registrar_map_.erase(pref_it); |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 } // namespace chrome | 816 } // namespace chrome |
| OLD | NEW |