Linux: Fix Debug build IO access warning (issue #1565)

This commit is contained in:
Marshall Greenblatt 2015-08-06 11:47:42 -07:00
parent 560b881a2f
commit 828fe45bc1
1 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "net/base/mime_util.h" #include "net/base/mime_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
@ -27,6 +28,10 @@ base::FilePath FilePathFromASCII(const std::string& str) {
} }
static std::string GetMimeType(const std::string& filename) { static std::string GetMimeType(const std::string& filename) {
// Requests should not block on the disk! On POSIX this goes to disk.
// http://code.google.com/p/chromium/issues/detail?id=59849
base::ThreadRestrictions::ScopedAllowIO allow_io;
std::string mime_type; std::string mime_type;
if (net::GetMimeTypeFromFile(FilePathFromASCII(filename), &mime_type)) if (net::GetMimeTypeFromFile(FilePathFromASCII(filename), &mime_type))
return mime_type; return mime_type;