mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Update to Chromium revision 69409.
- Add cefclient tests for GPU acceleration. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@152 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -28,7 +28,8 @@ class BrowserFileWriter::IOThreadProxy
|
||||
: public base::RefCountedThreadSafe<BrowserFileWriter::IOThreadProxy> {
|
||||
public:
|
||||
explicit IOThreadProxy(const base::WeakPtr<BrowserFileWriter>& simple_writer)
|
||||
: simple_writer_(simple_writer) {
|
||||
: simple_writer_(simple_writer),
|
||||
operation_(NULL) {
|
||||
io_thread_ = CefThread::GetMessageLoopProxyForThread(CefThread::IO);
|
||||
main_thread_ = base::MessageLoopProxy::CreateForCurrentThread();
|
||||
}
|
||||
@@ -42,8 +43,8 @@ class BrowserFileWriter::IOThreadProxy
|
||||
this, &IOThreadProxy::Truncate, path, offset));
|
||||
return;
|
||||
}
|
||||
DCHECK(!operation_.get());
|
||||
operation_.reset(GetNewOperation());
|
||||
DCHECK(!operation_);
|
||||
operation_ = GetNewOperation();
|
||||
operation_->Truncate(path, offset);
|
||||
}
|
||||
|
||||
@@ -54,8 +55,8 @@ class BrowserFileWriter::IOThreadProxy
|
||||
return;
|
||||
}
|
||||
DCHECK(request_context_);
|
||||
DCHECK(!operation_.get());
|
||||
operation_.reset(GetNewOperation());
|
||||
DCHECK(!operation_);
|
||||
operation_ = GetNewOperation();
|
||||
operation_->Write(request_context_, path, blob_url, offset);
|
||||
}
|
||||
|
||||
@@ -65,12 +66,11 @@ class BrowserFileWriter::IOThreadProxy
|
||||
this, &IOThreadProxy::Cancel));
|
||||
return;
|
||||
}
|
||||
if (!operation_.get()) {
|
||||
if (!operation_) {
|
||||
DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
|
||||
return;
|
||||
}
|
||||
cancel_operation_.reset(GetNewOperation());
|
||||
operation_->Cancel(cancel_operation_.get());
|
||||
operation_->Cancel(GetNewOperation());
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -80,6 +80,10 @@ class BrowserFileWriter::IOThreadProxy
|
||||
explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) {
|
||||
}
|
||||
|
||||
~CallbackDispatcher() {
|
||||
proxy_->ClearOperation();
|
||||
}
|
||||
|
||||
virtual void DidSucceed() {
|
||||
proxy_->DidSucceed();
|
||||
}
|
||||
@@ -117,7 +121,6 @@ class BrowserFileWriter::IOThreadProxy
|
||||
|
||||
void DidSucceed() {
|
||||
if (!main_thread_->BelongsToCurrentThread()) {
|
||||
operation_.reset();
|
||||
main_thread_->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &IOThreadProxy::DidSucceed));
|
||||
return;
|
||||
@@ -128,7 +131,6 @@ class BrowserFileWriter::IOThreadProxy
|
||||
|
||||
void DidFail(base::PlatformFileError error_code) {
|
||||
if (!main_thread_->BelongsToCurrentThread()) {
|
||||
operation_.reset();
|
||||
main_thread_->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &IOThreadProxy::DidFail, error_code));
|
||||
return;
|
||||
@@ -139,8 +141,6 @@ class BrowserFileWriter::IOThreadProxy
|
||||
|
||||
void DidWrite(int64 bytes, bool complete) {
|
||||
if (!main_thread_->BelongsToCurrentThread()) {
|
||||
if (complete)
|
||||
operation_.reset();
|
||||
main_thread_->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &IOThreadProxy::DidWrite, bytes, complete));
|
||||
return;
|
||||
@@ -149,6 +149,11 @@ class BrowserFileWriter::IOThreadProxy
|
||||
simple_writer_->DidWrite(bytes, complete);
|
||||
}
|
||||
|
||||
void ClearOperation() {
|
||||
DCHECK(io_thread_->BelongsToCurrentThread());
|
||||
operation_ = NULL;
|
||||
}
|
||||
|
||||
scoped_refptr<base::MessageLoopProxy> io_thread_;
|
||||
scoped_refptr<base::MessageLoopProxy> main_thread_;
|
||||
|
||||
@@ -156,8 +161,7 @@ class BrowserFileWriter::IOThreadProxy
|
||||
base::WeakPtr<BrowserFileWriter> simple_writer_;
|
||||
|
||||
// Only used on the io thread.
|
||||
scoped_ptr<FileSystemOperation> operation_;
|
||||
scoped_ptr<FileSystemOperation> cancel_operation_;
|
||||
FileSystemOperation* operation_;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user