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

Unified Diff: webkit/fileapi/media/media_path_filter.cc

Issue 10827157: Remove ScopedAllowIO from MediaPathFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/media/media_path_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/media/media_path_filter.cc
diff --git a/webkit/fileapi/media/media_path_filter.cc b/webkit/fileapi/media/media_path_filter.cc
index 3dd92017cdd7d218bd702db4eb6db81bb7018f2d..fdbc6a69f2cd5c6707d82d155e0977a846fe5788 100644
--- a/webkit/fileapi/media/media_path_filter.cc
+++ b/webkit/fileapi/media/media_path_filter.cc
@@ -8,7 +8,6 @@
#include <string>
#include "base/string_util.h"
-#include "base/threading/thread_restrictions.h"
#include "net/base/mime_util.h"
namespace fileapi {
@@ -23,10 +22,27 @@ bool IsUnsupportedExtension(const FilePath::StringType& extension) {
} // namespace
-MediaPathFilter::MediaPathFilter() {
- // TODO(tzik): http://crbug.com/140401
- // Remove this ScopedAllowIO after move this to FILE thread.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
+MediaPathFilter::MediaPathFilter()
+ : initialized_(false) {
+}
+
+MediaPathFilter::~MediaPathFilter() {
+}
+
+bool MediaPathFilter::Match(const FilePath& path) {
+ EnsureInitialized();
+ return std::binary_search(media_file_extensions_.begin(),
+ media_file_extensions_.end(),
+ StringToLowerASCII(path.Extension()));
+}
+
+void MediaPathFilter::EnsureInitialized() {
+ if (initialized_)
+ return;
+
+ base::AutoLock lock(initialization_lock_);
kinuko 2012/08/03 20:58:57 qq: does this need a lock?
tzik 2012/08/03 21:24:02 Might not be needed, AFA we run {Native,Device}Med
+ if (initialized_)
+ return;
net::GetImageExtensions(&media_file_extensions_);
net::GetAudioExtensions(&media_file_extensions_);
@@ -42,15 +58,8 @@ MediaPathFilter::MediaPathFilter() {
itr != media_file_extensions_.end(); ++itr)
*itr = FilePath::kExtensionSeparator + *itr;
std::sort(media_file_extensions_.begin(), media_file_extensions_.end());
-}
-MediaPathFilter::~MediaPathFilter() {
-}
-
-bool MediaPathFilter::Match(const FilePath& path) const {
- return std::binary_search(media_file_extensions_.begin(),
- media_file_extensions_.end(),
- StringToLowerASCII(path.Extension()));
+ initialized_ = true;
}
} // namespace fileapi
« no previous file with comments | « webkit/fileapi/media/media_path_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698