From 0e8a017416ec3648ff8f67cbf084da7c5fdcca4b Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 11 Feb 2014 22:44:35 +0000 Subject: [PATCH] Allow usage of file streams on IO-prohibited threads (issue #1187). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1622 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/browser/stream_impl.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libcef/browser/stream_impl.cc b/libcef/browser/stream_impl.cc index 4941e7a7d..a3017d7a0 100644 --- a/libcef/browser/stream_impl.cc +++ b/libcef/browser/stream_impl.cc @@ -6,11 +6,17 @@ #include #include "base/file_util.h" #include "base/logging.h" +#include "base/threading/thread_restrictions.h" // Static functions CefRefPtr CefStreamReader::CreateForFile( const CefString& fileName) { + DCHECK(!fileName.empty()); + + // TODO(cef): Do not allow file IO on all threads (issue #1187). + base::ThreadRestrictions::ScopedAllowIO allow_io; + CefRefPtr reader; FILE* file = base::OpenFile(base::FilePath(fileName), "rb"); if (file) @@ -40,6 +46,10 @@ CefRefPtr CefStreamReader::CreateForHandler( CefRefPtr CefStreamWriter::CreateForFile( const CefString& fileName) { DCHECK(!fileName.empty()); + + // TODO(cef): Do not allow file IO on all threads (issue #1187). + base::ThreadRestrictions::ScopedAllowIO allow_io; + CefRefPtr writer; FILE* file = base::OpenFile(base::FilePath(fileName), "wb"); if (file)