Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/media_galleries/fileapi/media_path_filter.cc

Issue 2189113002: Rename CalledOnValidSequencedThread() to CalledOnValidSequence(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/media_galleries/fileapi/media_path_filter.h" 5 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 MediaGalleryFileType MediaPathFilter::GetType(const base::FilePath& path) { 154 MediaGalleryFileType MediaPathFilter::GetType(const base::FilePath& path) {
155 EnsureInitialized(); 155 EnsureInitialized();
156 MediaFileExtensionMap::const_iterator it = 156 MediaFileExtensionMap::const_iterator it =
157 media_file_extensions_map_.find(base::ToLowerASCII(path.Extension())); 157 media_file_extensions_map_.find(base::ToLowerASCII(path.Extension()));
158 if (it == media_file_extensions_map_.end()) 158 if (it == media_file_extensions_map_.end())
159 return MEDIA_GALLERY_FILE_TYPE_UNKNOWN; 159 return MEDIA_GALLERY_FILE_TYPE_UNKNOWN;
160 return static_cast<MediaGalleryFileType>(it->second); 160 return static_cast<MediaGalleryFileType>(it->second);
161 } 161 }
162 162
163 void MediaPathFilter::EnsureInitialized() { 163 void MediaPathFilter::EnsureInitialized() {
164 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 164 DCHECK(sequence_checker_.CalledOnValidSequence());
165 if (initialized_) 165 if (initialized_)
166 return; 166 return;
167 167
168 // This may require I/O when it calls net::GetExtensionsForMimeType(), so 168 // This may require I/O when it calls net::GetExtensionsForMimeType(), so
169 // doing this in the ctor and removing |initialized_| would result in a 169 // doing this in the ctor and removing |initialized_| would result in a
170 // ThreadRestrictions failure. 170 // ThreadRestrictions failure.
171 AddExtensionsToMediaFileExtensionMap(GetMediaExtensionList("image/*"), 171 AddExtensionsToMediaFileExtensionMap(GetMediaExtensionList("image/*"),
172 MEDIA_GALLERY_FILE_TYPE_IMAGE); 172 MEDIA_GALLERY_FILE_TYPE_IMAGE);
173 AddExtensionsToMediaFileExtensionMap(GetMediaExtensionList("audio/*"), 173 AddExtensionsToMediaFileExtensionMap(GetMediaExtensionList("audio/*"),
174 MEDIA_GALLERY_FILE_TYPE_AUDIO); 174 MEDIA_GALLERY_FILE_TYPE_AUDIO);
(...skipping 28 matching lines...) Expand all
203 } 203 }
204 204
205 void MediaPathFilter::AddExtensionToMediaFileExtensionMap( 205 void MediaPathFilter::AddExtensionToMediaFileExtensionMap(
206 const base::FilePath::CharType* extension, 206 const base::FilePath::CharType* extension,
207 MediaGalleryFileType type) { 207 MediaGalleryFileType type) {
208 base::FilePath::StringType extension_with_sep = 208 base::FilePath::StringType extension_with_sep =
209 base::FilePath::kExtensionSeparator + 209 base::FilePath::kExtensionSeparator +
210 base::FilePath::StringType(extension); 210 base::FilePath::StringType(extension);
211 media_file_extensions_map_[extension_with_sep] |= type; 211 media_file_extensions_map_[extension_with_sep] |= type;
212 } 212 }
OLDNEW
« no previous file with comments | « chrome/browser/image_decoder.cc ('k') | chrome/browser/sync_file_system/drive_backend/drive_service_on_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698