mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 149431.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@731 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -6,13 +6,17 @@
|
||||
#include "libcef/cef_thread.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/location.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop_proxy.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "webkit/fileapi/file_system_context.h"
|
||||
#include "webkit/fileapi/file_system_operation_interface.h"
|
||||
#include "webkit/fileapi/file_system_types.h"
|
||||
#include "webkit/fileapi/file_system_url.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
using fileapi::FileSystemURL;
|
||||
using fileapi::FileSystemContext;
|
||||
using fileapi::FileSystemOperationInterface;
|
||||
using fileapi::WebFileWriterBase;
|
||||
@@ -37,30 +41,34 @@ class BrowserFileWriter::IOThreadProxy
|
||||
main_thread_ = base::MessageLoopProxy::current();
|
||||
}
|
||||
|
||||
void Truncate(const GURL& path, int64 offset) {
|
||||
void Truncate(const FileSystemURL& url, int64 offset) {
|
||||
if (!io_thread_->BelongsToCurrentThread()) {
|
||||
io_thread_->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&IOThreadProxy::Truncate, this, path, offset));
|
||||
base::Bind(&IOThreadProxy::Truncate, this, url, offset));
|
||||
return;
|
||||
}
|
||||
if (FailIfNotWritable(url))
|
||||
return;
|
||||
DCHECK(!operation_);
|
||||
operation_ = GetNewOperation(path);
|
||||
operation_->Truncate(path, offset,
|
||||
operation_ = GetNewOperation(url);
|
||||
operation_->Truncate(url, offset,
|
||||
base::Bind(&IOThreadProxy::DidFinish, this));
|
||||
}
|
||||
|
||||
void Write(const GURL& path, const GURL& blob_url, int64 offset) {
|
||||
void Write(const FileSystemURL& url, const GURL& blob_url, int64 offset) {
|
||||
if (!io_thread_->BelongsToCurrentThread()) {
|
||||
io_thread_->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&IOThreadProxy::Write, this, path, blob_url, offset));
|
||||
base::Bind(&IOThreadProxy::Write, this, url, blob_url, offset));
|
||||
return;
|
||||
}
|
||||
if (FailIfNotWritable(url))
|
||||
return;
|
||||
DCHECK(request_context_);
|
||||
DCHECK(!operation_);
|
||||
operation_ = GetNewOperation(path);
|
||||
operation_->Write(request_context_, path, blob_url, offset,
|
||||
operation_ = GetNewOperation(url);
|
||||
operation_->Write(request_context_, url, blob_url, offset,
|
||||
base::Bind(&IOThreadProxy::DidWrite, this));
|
||||
}
|
||||
|
||||
@@ -82,8 +90,18 @@ class BrowserFileWriter::IOThreadProxy
|
||||
friend class base::RefCountedThreadSafe<IOThreadProxy>;
|
||||
virtual ~IOThreadProxy() {}
|
||||
|
||||
FileSystemOperationInterface* GetNewOperation(const GURL& path) {
|
||||
return file_system_context_->CreateFileSystemOperation(path);
|
||||
FileSystemOperationInterface* GetNewOperation( const FileSystemURL& url) {
|
||||
return file_system_context_->CreateFileSystemOperation(url);
|
||||
}
|
||||
|
||||
// Returns true if it is not writable.
|
||||
bool FailIfNotWritable(const FileSystemURL& url) {
|
||||
if (url.type() == fileapi::kFileSystemTypeIsolated) {
|
||||
// Write is not allowed in isolate file system in BrowserFileWriter.
|
||||
DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DidSucceedOnMainThread() {
|
||||
@@ -169,12 +187,14 @@ BrowserFileWriter::~BrowserFileWriter() {
|
||||
}
|
||||
|
||||
void BrowserFileWriter::DoTruncate(const GURL& path, int64 offset) {
|
||||
io_thread_proxy_->Truncate(path, offset);
|
||||
FileSystemURL url(path);
|
||||
io_thread_proxy_->Truncate(url, offset);
|
||||
}
|
||||
|
||||
void BrowserFileWriter::DoWrite(
|
||||
const GURL& path, const GURL& blob_url, int64 offset) {
|
||||
io_thread_proxy_->Write(path, blob_url, offset);
|
||||
FileSystemURL url(path);
|
||||
io_thread_proxy_->Write(url, blob_url, offset);
|
||||
}
|
||||
|
||||
void BrowserFileWriter::DoCancel() {
|
||||
|
Reference in New Issue
Block a user