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
This commit is contained in:
Marshall Greenblatt 2014-02-11 22:44:35 +00:00
parent b5700a6f4c
commit 0e8a017416
1 changed files with 10 additions and 0 deletions

View File

@ -6,11 +6,17 @@
#include <stdlib.h>
#include "base/file_util.h"
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
// Static functions
CefRefPtr<CefStreamReader> 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<CefStreamReader> reader;
FILE* file = base::OpenFile(base::FilePath(fileName), "rb");
if (file)
@ -40,6 +46,10 @@ CefRefPtr<CefStreamReader> CefStreamReader::CreateForHandler(
CefRefPtr<CefStreamWriter> 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<CefStreamWriter> writer;
FILE* file = base::OpenFile(base::FilePath(fileName), "wb");
if (file)