mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 119867.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@504 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -17,5 +17,5 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
||||||
'chromium_revision': '115967',
|
'chromium_revision': '119867',
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/bind_helpers.h"
|
#include "base/bind_helpers.h"
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/task.h"
|
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
#include "webkit/appcache/appcache_interceptor.h"
|
#include "webkit/appcache/appcache_interceptor.h"
|
||||||
#include "webkit/appcache/web_application_cache_host_impl.h"
|
#include "webkit/appcache/web_application_cache_host_impl.h"
|
||||||
@ -267,8 +266,9 @@ class BrowserBackendProxy
|
|||||||
status_result_ = appcache::UNCACHED;
|
status_result_ = appcache::UNCACHED;
|
||||||
event_.Reset();
|
event_.Reset();
|
||||||
system_->io_message_loop()->PostTask(
|
system_->io_message_loop()->PostTask(
|
||||||
FROM_HERE, base::IgnoreReturn<appcache::Status>(
|
FROM_HERE,
|
||||||
base::Bind(&BrowserBackendProxy::GetStatus, this, host_id)));
|
base::Bind(base::IgnoreResult(&BrowserBackendProxy::GetStatus),
|
||||||
|
this, host_id));
|
||||||
event_.Wait();
|
event_.Wait();
|
||||||
} else if (system_->is_io_thread()) {
|
} else if (system_->is_io_thread()) {
|
||||||
system_->backend_impl_->GetStatusWithCallback(
|
system_->backend_impl_->GetStatusWithCallback(
|
||||||
@ -284,8 +284,9 @@ class BrowserBackendProxy
|
|||||||
bool_result_ = false;
|
bool_result_ = false;
|
||||||
event_.Reset();
|
event_.Reset();
|
||||||
system_->io_message_loop()->PostTask(
|
system_->io_message_loop()->PostTask(
|
||||||
FROM_HERE, base::IgnoreReturn<bool>(
|
FROM_HERE,
|
||||||
base::Bind(&BrowserBackendProxy::StartUpdate, this, host_id)));
|
base::Bind(base::IgnoreResult(&BrowserBackendProxy::StartUpdate),
|
||||||
|
this, host_id));
|
||||||
event_.Wait();
|
event_.Wait();
|
||||||
} else if (system_->is_io_thread()) {
|
} else if (system_->is_io_thread()) {
|
||||||
system_->backend_impl_->StartUpdateWithCallback(
|
system_->backend_impl_->StartUpdateWithCallback(
|
||||||
@ -301,8 +302,9 @@ class BrowserBackendProxy
|
|||||||
bool_result_ = false;
|
bool_result_ = false;
|
||||||
event_.Reset();
|
event_.Reset();
|
||||||
system_->io_message_loop()->PostTask(
|
system_->io_message_loop()->PostTask(
|
||||||
FROM_HERE, base::IgnoreReturn<bool>(
|
FROM_HERE,
|
||||||
base::Bind(&BrowserBackendProxy::SwapCache, this, host_id)));
|
base::Bind(base::IgnoreResult(&BrowserBackendProxy::SwapCache),
|
||||||
|
this, host_id));
|
||||||
event_.Wait();
|
event_.Wait();
|
||||||
} else if (system_->is_io_thread()) {
|
} else if (system_->is_io_thread()) {
|
||||||
system_->backend_impl_->SwapCacheWithCallback(
|
system_->backend_impl_->SwapCacheWithCallback(
|
||||||
|
@ -248,7 +248,9 @@ void BrowserDatabaseSystem::VfsDeleteFile(
|
|||||||
*result = VfsBackend::DeleteFile(file_name, sync_dir);
|
*result = VfsBackend::DeleteFile(file_name, sync_dir);
|
||||||
} while ((++num_retries < kNumDeleteRetries) &&
|
} while ((++num_retries < kNumDeleteRetries) &&
|
||||||
(*result == SQLITE_IOERR_DELETE) &&
|
(*result == SQLITE_IOERR_DELETE) &&
|
||||||
(base::PlatformThread::Sleep(10), 1));
|
(base::PlatformThread::Sleep(
|
||||||
|
base::TimeDelta::FromMilliseconds(10)),
|
||||||
|
1));
|
||||||
|
|
||||||
done_event->Signal();
|
done_event->Signal();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/task.h"
|
|
||||||
|
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h"
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/task.h"
|
|
||||||
|
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h"
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "libcef/web_drag_utils_win.h"
|
#include "libcef/web_drag_utils_win.h"
|
||||||
#include "libcef/web_drop_target_win.h"
|
#include "libcef/web_drop_target_win.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "net/base/file_stream.h"
|
#include "net/base/file_stream.h"
|
||||||
#include "net/base/net_util.h"
|
#include "net/base/net_util.h"
|
||||||
@ -142,8 +143,8 @@ void BrowserDragDelegate::StartDragging(const WebDropData& drop_data,
|
|||||||
if (drag_drop_thread_->StartWithOptions(options)) {
|
if (drag_drop_thread_->StartWithOptions(options)) {
|
||||||
drag_drop_thread_->message_loop()->PostTask(
|
drag_drop_thread_->message_loop()->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
NewRunnableMethod(this,
|
base::Bind(&BrowserDragDelegate::StartBackgroundDragging,
|
||||||
&BrowserDragDelegate::StartBackgroundDragging,
|
this,
|
||||||
drop_data,
|
drop_data,
|
||||||
ops,
|
ops,
|
||||||
page_url,
|
page_url,
|
||||||
@ -179,7 +180,7 @@ void BrowserDragDelegate::StartBackgroundDragging(
|
|||||||
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
|
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &BrowserDragDelegate::EndDragging, true));
|
base::Bind(&BrowserDragDelegate::EndDragging, this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserDragDelegate::PrepareDragForDownload(
|
void BrowserDragDelegate::PrepareDragForDownload(
|
||||||
@ -343,7 +344,7 @@ void BrowserDragDelegate::OnWaitForData() {
|
|||||||
// mode so that it can start to process the normal input events.
|
// mode so that it can start to process the normal input events.
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &BrowserDragDelegate::EndDragging, true));
|
base::Bind(&BrowserDragDelegate::EndDragging, this, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserDragDelegate::OnDataObjectDisposed() {
|
void BrowserDragDelegate::OnDataObjectDisposed() {
|
||||||
@ -353,5 +354,5 @@ void BrowserDragDelegate::OnDataObjectDisposed() {
|
|||||||
// DataObjectImpl.
|
// DataObjectImpl.
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &BrowserDragDelegate::CloseThread));
|
base::Bind(&BrowserDragDelegate::CloseThread, this));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@ -7,7 +7,6 @@
|
|||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/memory/scoped_callback_factory.h"
|
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/message_loop_proxy.h"
|
#include "base/message_loop_proxy.h"
|
||||||
#include "base/time.h"
|
#include "base/time.h"
|
||||||
@ -23,10 +22,11 @@
|
|||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
|
||||||
#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
||||||
#include "webkit/fileapi/file_system_context.h"
|
#include "webkit/fileapi/file_system_context.h"
|
||||||
#include "webkit/fileapi/file_system_operation.h"
|
#include "webkit/fileapi/file_system_operation_interface.h"
|
||||||
#include "webkit/fileapi/file_system_path_manager.h"
|
|
||||||
#include "webkit/fileapi/file_system_types.h"
|
#include "webkit/fileapi/file_system_types.h"
|
||||||
|
#include "webkit/fileapi/mock_file_system_options.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
|
#include "webkit/tools/test_shell/simple_file_writer.h"
|
||||||
|
|
||||||
using base::WeakPtr;
|
using base::WeakPtr;
|
||||||
|
|
||||||
@ -44,18 +44,20 @@ using WebKit::WebVector;
|
|||||||
|
|
||||||
using fileapi::FileSystemCallbackDispatcher;
|
using fileapi::FileSystemCallbackDispatcher;
|
||||||
using fileapi::FileSystemContext;
|
using fileapi::FileSystemContext;
|
||||||
using fileapi::FileSystemOperation;
|
using fileapi::FileSystemOperationInterface;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class BrowserFileSystemCallbackDispatcher
|
class BrowserFileSystemCallbackDispatcher
|
||||||
: public FileSystemCallbackDispatcher {
|
: public FileSystemCallbackDispatcher {
|
||||||
public:
|
public:
|
||||||
BrowserFileSystemCallbackDispatcher(
|
// An instance of this class must be created by Create()
|
||||||
|
// (so that we do not leak ownerships).
|
||||||
|
static scoped_ptr<FileSystemCallbackDispatcher> Create(
|
||||||
const WeakPtr<BrowserFileSystem>& file_system,
|
const WeakPtr<BrowserFileSystem>& file_system,
|
||||||
WebFileSystemCallbacks* callbacks)
|
WebFileSystemCallbacks* callbacks) {
|
||||||
: file_system_(file_system),
|
return scoped_ptr<FileSystemCallbackDispatcher>(
|
||||||
callbacks_(callbacks) {
|
new BrowserFileSystemCallbackDispatcher(file_system, callbacks));
|
||||||
}
|
}
|
||||||
|
|
||||||
~BrowserFileSystemCallbackDispatcher() {
|
~BrowserFileSystemCallbackDispatcher() {
|
||||||
@ -116,6 +118,13 @@ class BrowserFileSystemCallbackDispatcher
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BrowserFileSystemCallbackDispatcher(
|
||||||
|
const WeakPtr<BrowserFileSystem>& file_system,
|
||||||
|
WebFileSystemCallbacks* callbacks)
|
||||||
|
: file_system_(file_system),
|
||||||
|
callbacks_(callbacks) {
|
||||||
|
}
|
||||||
|
|
||||||
WeakPtr<BrowserFileSystem> file_system_;
|
WeakPtr<BrowserFileSystem> file_system_;
|
||||||
WebFileSystemCallbacks* callbacks_;
|
WebFileSystemCallbacks* callbacks_;
|
||||||
};
|
};
|
||||||
@ -133,15 +142,18 @@ void BrowserFileSystem::CreateContext() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (file_system_dir_.CreateUniqueTempDir()) {
|
if (file_system_dir_.CreateUniqueTempDir()) {
|
||||||
|
std::vector<std::string> additional_allowed_schemes;
|
||||||
|
additional_allowed_schemes.push_back("file");
|
||||||
|
|
||||||
file_system_context_ = new FileSystemContext(
|
file_system_context_ = new FileSystemContext(
|
||||||
CefThread::GetMessageLoopProxyForThread(CefThread::FILE),
|
CefThread::GetMessageLoopProxyForThread(CefThread::FILE),
|
||||||
CefThread::GetMessageLoopProxyForThread(CefThread::IO),
|
CefThread::GetMessageLoopProxyForThread(CefThread::IO),
|
||||||
NULL /* special storage policy */,
|
NULL /* special storage policy */,
|
||||||
NULL /* quota manager */,
|
NULL /* quota manager */,
|
||||||
file_system_dir_.path(),
|
file_system_dir_.path(),
|
||||||
false /* incognito */,
|
fileapi::FileSystemOptions(
|
||||||
true /* allow_file_access */,
|
fileapi::FileSystemOptions::PROFILE_MODE_NORMAL,
|
||||||
NULL);
|
additional_allowed_schemes));
|
||||||
} else {
|
} else {
|
||||||
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
|
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
|
||||||
"FileSystem feature will be disabled.";
|
"FileSystem feature will be disabled.";
|
||||||
@ -159,72 +171,74 @@ void BrowserFileSystem::OpenFileSystem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileapi::FileSystemType type;
|
fileapi::FileSystemType type;
|
||||||
if (web_filesystem_type == WebFileSystem::TypeTemporary) {
|
if (web_filesystem_type == WebFileSystem::TypeTemporary)
|
||||||
type = fileapi::kFileSystemTypeTemporary;
|
type = fileapi::kFileSystemTypeTemporary;
|
||||||
} else if (web_filesystem_type == WebFileSystem::TypePersistent) {
|
else if (web_filesystem_type == WebFileSystem::TypePersistent)
|
||||||
type = fileapi::kFileSystemTypePersistent;
|
type = fileapi::kFileSystemTypePersistent;
|
||||||
} else if (web_filesystem_type == WebFileSystem::TypeExternal) {
|
else if (web_filesystem_type == WebFileSystem::TypeExternal)
|
||||||
type = fileapi::kFileSystemTypeExternal;
|
type = fileapi::kFileSystemTypeExternal;
|
||||||
} else {
|
else {
|
||||||
// Unknown type filesystem is requested.
|
// Unknown type filesystem is requested.
|
||||||
callbacks->didFail(WebKit::WebFileErrorSecurity);
|
callbacks->didFail(WebKit::WebFileErrorSecurity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GURL origin_url(frame->document().securityOrigin().toString());
|
GURL origin_url(frame->document().securityOrigin().toString());
|
||||||
GetNewOperation(callbacks)->OpenFileSystem(origin_url, type, create);
|
file_system_context_->OpenFileSystem(
|
||||||
|
origin_url, type, create,
|
||||||
|
BrowserFileSystemCallbackDispatcher::Create(AsWeakPtr(), callbacks));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::move(
|
void BrowserFileSystem::move(
|
||||||
const WebURL& src_path,
|
const WebURL& src_path,
|
||||||
const WebURL& dest_path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& dest_path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->Move(GURL(src_path), GURL(dest_path));
|
GetNewOperation(src_path, callbacks)->Move(GURL(src_path), GURL(dest_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::copy(
|
void BrowserFileSystem::copy(
|
||||||
const WebURL& src_path, const WebURL& dest_path,
|
const WebURL& src_path, const WebURL& dest_path,
|
||||||
WebFileSystemCallbacks* callbacks) {
|
WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->Copy(GURL(src_path), GURL(dest_path));
|
GetNewOperation(src_path, callbacks)->Copy(GURL(src_path), GURL(dest_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::remove(
|
void BrowserFileSystem::remove(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->Remove(path, false /* recursive */);
|
GetNewOperation(path, callbacks)->Remove(path, false /* recursive */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::removeRecursively(
|
void BrowserFileSystem::removeRecursively(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->Remove(path, true /* recursive */);
|
GetNewOperation(path, callbacks)->Remove(path, true /* recursive */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::readMetadata(
|
void BrowserFileSystem::readMetadata(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->GetMetadata(path);
|
GetNewOperation(path, callbacks)->GetMetadata(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::createFile(
|
void BrowserFileSystem::createFile(
|
||||||
const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->CreateFile(path, exclusive);
|
GetNewOperation(path, callbacks)->CreateFile(path, exclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::createDirectory(
|
void BrowserFileSystem::createDirectory(
|
||||||
const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, bool exclusive, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->CreateDirectory(path, exclusive, false);
|
GetNewOperation(path, callbacks)->CreateDirectory(path, exclusive, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::fileExists(
|
void BrowserFileSystem::fileExists(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->FileExists(path);
|
GetNewOperation(path, callbacks)->FileExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::directoryExists(
|
void BrowserFileSystem::directoryExists(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->DirectoryExists(path);
|
GetNewOperation(path, callbacks)->DirectoryExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserFileSystem::readDirectory(
|
void BrowserFileSystem::readDirectory(
|
||||||
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
const WebURL& path, WebFileSystemCallbacks* callbacks) {
|
||||||
GetNewOperation(callbacks)->ReadDirectory(path);
|
GetNewOperation(path, callbacks)->ReadDirectory(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebFileWriter* BrowserFileSystem::createFileWriter(
|
WebFileWriter* BrowserFileSystem::createFileWriter(
|
||||||
@ -232,12 +246,10 @@ WebFileWriter* BrowserFileSystem::createFileWriter(
|
|||||||
return new BrowserFileWriter(path, client, file_system_context_.get());
|
return new BrowserFileWriter(path, client, file_system_context_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemOperation* BrowserFileSystem::GetNewOperation(
|
FileSystemOperationInterface* BrowserFileSystem::GetNewOperation(
|
||||||
WebFileSystemCallbacks* callbacks) {
|
const WebURL& url, WebFileSystemCallbacks* callbacks) {
|
||||||
BrowserFileSystemCallbackDispatcher* dispatcher =
|
return file_system_context_->CreateFileSystemOperation(
|
||||||
new BrowserFileSystemCallbackDispatcher(AsWeakPtr(), callbacks);
|
GURL(url),
|
||||||
FileSystemOperation* operation = new FileSystemOperation(
|
BrowserFileSystemCallbackDispatcher::Create(AsWeakPtr(), callbacks),
|
||||||
dispatcher, base::MessageLoopProxy::current(),
|
base::MessageLoopProxy::current());
|
||||||
file_system_context_.get());
|
|
||||||
return operation;
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class WebURL;
|
|||||||
|
|
||||||
namespace fileapi {
|
namespace fileapi {
|
||||||
class FileSystemContext;
|
class FileSystemContext;
|
||||||
class FileSystemOperation;
|
class FileSystemOperationInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BrowserFileSystem
|
class BrowserFileSystem
|
||||||
@ -85,8 +85,8 @@ class BrowserFileSystem
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Helpers.
|
// Helpers.
|
||||||
fileapi::FileSystemOperation* GetNewOperation(
|
fileapi::FileSystemOperationInterface* GetNewOperation(
|
||||||
WebKit::WebFileSystemCallbacks* callbacks);
|
const WebKit::WebURL& path, WebKit::WebFileSystemCallbacks* callbacks);
|
||||||
|
|
||||||
// A temporary directory for FileSystem API.
|
// A temporary directory for FileSystem API.
|
||||||
ScopedTempDir file_system_dir_;
|
ScopedTempDir file_system_dir_;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@ -11,12 +11,12 @@
|
|||||||
#include "net/url_request/url_request_context.h"
|
#include "net/url_request/url_request_context.h"
|
||||||
#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
#include "webkit/fileapi/file_system_callback_dispatcher.h"
|
||||||
#include "webkit/fileapi/file_system_context.h"
|
#include "webkit/fileapi/file_system_context.h"
|
||||||
#include "webkit/fileapi/file_system_operation.h"
|
#include "webkit/fileapi/file_system_operation_interface.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
|
|
||||||
using fileapi::FileSystemCallbackDispatcher;
|
using fileapi::FileSystemCallbackDispatcher;
|
||||||
using fileapi::FileSystemContext;
|
using fileapi::FileSystemContext;
|
||||||
using fileapi::FileSystemOperation;
|
using fileapi::FileSystemOperationInterface;
|
||||||
using fileapi::WebFileWriterBase;
|
using fileapi::WebFileWriterBase;
|
||||||
using WebKit::WebFileWriterClient;
|
using WebKit::WebFileWriterClient;
|
||||||
using WebKit::WebString;
|
using WebKit::WebString;
|
||||||
@ -50,7 +50,7 @@ class BrowserFileWriter::IOThreadProxy
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DCHECK(!operation_);
|
DCHECK(!operation_);
|
||||||
operation_ = GetNewOperation();
|
operation_ = GetNewOperation(path);
|
||||||
operation_->Truncate(path, offset);
|
operation_->Truncate(path, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class BrowserFileWriter::IOThreadProxy
|
|||||||
}
|
}
|
||||||
DCHECK(request_context_);
|
DCHECK(request_context_);
|
||||||
DCHECK(!operation_);
|
DCHECK(!operation_);
|
||||||
operation_ = GetNewOperation();
|
operation_ = GetNewOperation(path);
|
||||||
operation_->Write(request_context_, path, blob_url, offset);
|
operation_->Write(request_context_, path, blob_url, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,14 +78,19 @@ class BrowserFileWriter::IOThreadProxy
|
|||||||
DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
|
DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
operation_->Cancel(GetNewOperation());
|
operation_->Cancel(CallbackDispatcher::Create(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Inner class to receive callbacks from FileSystemOperation.
|
// Inner class to receive callbacks from FileSystemOperation.
|
||||||
class CallbackDispatcher : public FileSystemCallbackDispatcher {
|
class CallbackDispatcher : public FileSystemCallbackDispatcher {
|
||||||
public:
|
public:
|
||||||
explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) {
|
// An instance of this class must be created by Create()
|
||||||
|
// (so that we do not leak ownerships).
|
||||||
|
static scoped_ptr<FileSystemCallbackDispatcher> Create(
|
||||||
|
IOThreadProxy* proxy) {
|
||||||
|
return scoped_ptr<FileSystemCallbackDispatcher>(
|
||||||
|
new CallbackDispatcher(proxy));
|
||||||
}
|
}
|
||||||
|
|
||||||
~CallbackDispatcher() {
|
~CallbackDispatcher() {
|
||||||
@ -122,13 +127,15 @@ class BrowserFileWriter::IOThreadProxy
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) {}
|
||||||
scoped_refptr<IOThreadProxy> proxy_;
|
scoped_refptr<IOThreadProxy> proxy_;
|
||||||
};
|
};
|
||||||
|
|
||||||
FileSystemOperation* GetNewOperation() {
|
FileSystemOperationInterface* GetNewOperation(const GURL& path) {
|
||||||
// The FileSystemOperation takes ownership of the CallbackDispatcher.
|
// The FileSystemOperation takes ownership of the CallbackDispatcher.
|
||||||
return new FileSystemOperation(new CallbackDispatcher(this),
|
return file_system_context_->CreateFileSystemOperation(
|
||||||
io_thread_, file_system_context_.get());
|
path, CallbackDispatcher::Create(this), io_thread_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DidSucceed() {
|
void DidSucceed() {
|
||||||
@ -176,7 +183,7 @@ class BrowserFileWriter::IOThreadProxy
|
|||||||
base::WeakPtr<BrowserFileWriter> simple_writer_;
|
base::WeakPtr<BrowserFileWriter> simple_writer_;
|
||||||
|
|
||||||
// Only used on the io thread.
|
// Only used on the io thread.
|
||||||
FileSystemOperation* operation_;
|
FileSystemOperationInterface* operation_;
|
||||||
|
|
||||||
scoped_refptr<FileSystemContext> file_system_context_;
|
scoped_refptr<FileSystemContext> file_system_context_;
|
||||||
};
|
};
|
||||||
|
@ -38,10 +38,10 @@ class BrowserFileWriter : public fileapi::WebFileWriterBase,
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// WebFileWriterBase overrides
|
// WebFileWriterBase overrides
|
||||||
virtual void DoTruncate(const GURL& path, int64 offset);
|
virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE;
|
||||||
virtual void DoWrite(const GURL& path, const GURL& blob_url,
|
virtual void DoWrite(const GURL& path, const GURL& blob_url,
|
||||||
int64 offset);
|
int64 offset) OVERRIDE;
|
||||||
virtual void DoCancel();
|
virtual void DoCancel() OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class IOThreadProxy;
|
class IOThreadProxy;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "libcef/stream_impl.h"
|
#include "libcef/stream_impl.h"
|
||||||
#include "libcef/v8_impl.h"
|
#include "libcef/v8_impl.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
@ -116,8 +117,8 @@ bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo,
|
|||||||
// Create the browser on the UI thread.
|
// Create the browser on the UI thread.
|
||||||
CreateBrowserHelper* helper =
|
CreateBrowserHelper* helper =
|
||||||
new CreateBrowserHelper(windowInfo, client, url, settings);
|
new CreateBrowserHelper(windowInfo, client, url, settings);
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableFunction(
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
UIT_CreateBrowserWithHelper, helper));
|
base::Bind(UIT_CreateBrowserWithHelper, helper));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,41 +188,46 @@ CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::CloseBrowser() {
|
void CefBrowserImpl::CloseBrowser() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_CloseBrowser));
|
base::Bind(&CefBrowserImpl::UIT_CloseBrowser, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::GoBack() {
|
void CefBrowserImpl::GoBack() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_BACK));
|
base::Bind(&CefBrowserImpl::UIT_HandleActionView, this,
|
||||||
|
MENU_ID_NAV_BACK));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::GoForward() {
|
void CefBrowserImpl::GoForward() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_FORWARD));
|
base::Bind(&CefBrowserImpl::UIT_HandleActionView, this,
|
||||||
|
MENU_ID_NAV_FORWARD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Reload() {
|
void CefBrowserImpl::Reload() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_RELOAD));
|
base::Bind(&CefBrowserImpl::UIT_HandleActionView, this,
|
||||||
|
MENU_ID_NAV_RELOAD));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::ReloadIgnoreCache() {
|
void CefBrowserImpl::ReloadIgnoreCache() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_RELOAD_NOCACHE));
|
base::Bind(&CefBrowserImpl::UIT_HandleActionView, this,
|
||||||
|
MENU_ID_NAV_RELOAD_NOCACHE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::StopLoad() {
|
void CefBrowserImpl::StopLoad() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleActionView, MENU_ID_NAV_STOP));
|
base::Bind(&CefBrowserImpl::UIT_HandleActionView, this,
|
||||||
|
MENU_ID_NAV_STOP));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SetFocus(bool enable) {
|
void CefBrowserImpl::SetFocus(bool enable) {
|
||||||
if (CefThread::CurrentlyOn(CefThread::UI)) {
|
if (CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
UIT_SetFocus(UIT_GetWebViewHost(), enable);
|
UIT_SetFocus(UIT_GetWebViewHost(), enable);
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::SetFocus, enable));
|
base::Bind(&CefBrowserImpl::SetFocus, this, enable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,19 +289,20 @@ void CefBrowserImpl::Find(int identifier, const CefString& searchText,
|
|||||||
options.findNext = findNext;
|
options.findNext = findNext;
|
||||||
|
|
||||||
// Execute the request on the UI thread.
|
// Execute the request on the UI thread.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_Find, identifier, searchText, options));
|
base::Bind(&CefBrowserImpl::UIT_Find, this, identifier, searchText,
|
||||||
|
options));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::StopFinding(bool clearSelection) {
|
void CefBrowserImpl::StopFinding(bool clearSelection) {
|
||||||
// Execute the request on the UI thread.
|
// Execute the request on the UI thread.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_StopFinding, clearSelection));
|
base::Bind(&CefBrowserImpl::UIT_StopFinding, this, clearSelection));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SetZoomLevel(double zoomLevel) {
|
void CefBrowserImpl::SetZoomLevel(double zoomLevel) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SetZoomLevel, zoomLevel));
|
base::Bind(&CefBrowserImpl::UIT_SetZoomLevel, this, zoomLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::ClearHistory() {
|
void CefBrowserImpl::ClearHistory() {
|
||||||
@ -315,19 +322,19 @@ void CefBrowserImpl::ClearHistory() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::ClearHistory));
|
base::Bind(&CefBrowserImpl::ClearHistory, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::ShowDevTools() {
|
void CefBrowserImpl::ShowDevTools() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_ShowDevTools));
|
base::Bind(&CefBrowserImpl::UIT_ShowDevTools, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::CloseDevTools() {
|
void CefBrowserImpl::CloseDevTools() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_CloseDevTools));
|
base::Bind(&CefBrowserImpl::UIT_CloseDevTools, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) {
|
bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) {
|
||||||
@ -357,8 +364,8 @@ bool CefBrowserImpl::GetSize(PaintElementType type, int& width, int& height) {
|
|||||||
void CefBrowserImpl::SetSize(PaintElementType type, int width, int height) {
|
void CefBrowserImpl::SetSize(PaintElementType type, int width, int height) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SetSize, type, width, height));
|
base::Bind(&CefBrowserImpl::UIT_SetSize, this, type, width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserImpl::IsPopupVisible() {
|
bool CefBrowserImpl::IsPopupVisible() {
|
||||||
@ -373,15 +380,15 @@ bool CefBrowserImpl::IsPopupVisible() {
|
|||||||
void CefBrowserImpl::HidePopup() {
|
void CefBrowserImpl::HidePopup() {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_ClosePopupWidget));
|
base::Bind(&CefBrowserImpl::UIT_ClosePopupWidget, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Invalidate(const CefRect& dirtyRect) {
|
void CefBrowserImpl::Invalidate(const CefRect& dirtyRect) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_Invalidate, dirtyRect));
|
base::Bind(&CefBrowserImpl::UIT_Invalidate, this, dirtyRect));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserImpl::GetImage(PaintElementType type, int width, int height,
|
bool CefBrowserImpl::GetImage(PaintElementType type, int width, int height,
|
||||||
@ -407,92 +414,98 @@ void CefBrowserImpl::SendKeyEvent(KeyType type, int key, int modifiers,
|
|||||||
bool sysChar, bool imeChar) {
|
bool sysChar, bool imeChar) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendKeyEvent, type, key, modifiers, sysChar,
|
base::Bind(&CefBrowserImpl::UIT_SendKeyEvent, this, type, key, modifiers,
|
||||||
imeChar));
|
sysChar, imeChar));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SendMouseClickEvent(int x, int y, MouseButtonType type,
|
void CefBrowserImpl::SendMouseClickEvent(int x, int y, MouseButtonType type,
|
||||||
bool mouseUp, int clickCount) {
|
bool mouseUp, int clickCount) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendMouseClickEvent, x, y, type, mouseUp,
|
base::Bind(&CefBrowserImpl::UIT_SendMouseClickEvent, this, x, y, type,
|
||||||
clickCount));
|
mouseUp, clickCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SendMouseMoveEvent(int x, int y, bool mouseLeave) {
|
void CefBrowserImpl::SendMouseMoveEvent(int x, int y, bool mouseLeave) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendMouseMoveEvent, x, y, mouseLeave));
|
base::Bind(&CefBrowserImpl::UIT_SendMouseMoveEvent, this, x, y,
|
||||||
|
mouseLeave));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SendMouseWheelEvent(int x, int y, int delta) {
|
void CefBrowserImpl::SendMouseWheelEvent(int x, int y, int delta) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendMouseWheelEvent, x, y, delta));
|
base::Bind(&CefBrowserImpl::UIT_SendMouseWheelEvent, this, x, y, delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SendFocusEvent(bool setFocus) {
|
void CefBrowserImpl::SendFocusEvent(bool setFocus) {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendFocusEvent, setFocus));
|
base::Bind(&CefBrowserImpl::UIT_SendFocusEvent, this, setFocus));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SendCaptureLostEvent() {
|
void CefBrowserImpl::SendCaptureLostEvent() {
|
||||||
// Intentially post event tasks in all cases so that painting tasks can be
|
// Intentially post event tasks in all cases so that painting tasks can be
|
||||||
// handled at sane times.
|
// handled at sane times.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_SendCaptureLostEvent));
|
base::Bind(&CefBrowserImpl::UIT_SendCaptureLostEvent, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Undo(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Undo(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_UNDO, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_UNDO, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Redo(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Redo(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_REDO, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_REDO, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Cut(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Cut(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_CUT, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_CUT, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Copy(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Copy(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_COPY, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_COPY, frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Paste(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Paste(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_PASTE, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_PASTE,
|
||||||
|
frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::Delete(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Delete(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_DELETE, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_DELETE,
|
||||||
|
frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::SelectAll(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::SelectAll(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_SELECTALL, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_SELECTALL,
|
||||||
|
frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CefBrowserImpl::Print(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::Print(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_PRINT, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_PRINT,
|
||||||
|
frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::ViewSource(CefRefPtr<CefFrame> frame) {
|
void CefBrowserImpl::ViewSource(CefRefPtr<CefFrame> frame) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_HandleAction, MENU_ID_VIEWSOURCE, frame));
|
base::Bind(&CefBrowserImpl::UIT_HandleAction, this, MENU_ID_VIEWSOURCE,
|
||||||
|
frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefString CefBrowserImpl::GetSource(CefRefPtr<CefFrame> frame) {
|
CefString CefBrowserImpl::GetSource(CefRefPtr<CefFrame> frame) {
|
||||||
@ -526,38 +539,40 @@ CefString CefBrowserImpl::GetText(CefRefPtr<CefFrame> frame) {
|
|||||||
void CefBrowserImpl::LoadRequest(CefRefPtr<CefFrame> frame,
|
void CefBrowserImpl::LoadRequest(CefRefPtr<CefFrame> frame,
|
||||||
CefRefPtr<CefRequest> request) {
|
CefRefPtr<CefRequest> request) {
|
||||||
DCHECK(request.get() != NULL);
|
DCHECK(request.get() != NULL);
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_LoadURLForRequestRef, frame, request));
|
base::Bind(&CefBrowserImpl::UIT_LoadURLForRequestRef, this, frame,
|
||||||
|
request));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::LoadURL(CefRefPtr<CefFrame> frame,
|
void CefBrowserImpl::LoadURL(CefRefPtr<CefFrame> frame,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_LoadURL, frame, url));
|
base::Bind(&CefBrowserImpl::UIT_LoadURL, this, frame, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::LoadString(CefRefPtr<CefFrame> frame,
|
void CefBrowserImpl::LoadString(CefRefPtr<CefFrame> frame,
|
||||||
const CefString& string,
|
const CefString& string,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_LoadHTML, frame, string, url));
|
base::Bind(&CefBrowserImpl::UIT_LoadHTML, this, frame, string, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::LoadStream(CefRefPtr<CefFrame> frame,
|
void CefBrowserImpl::LoadStream(CefRefPtr<CefFrame> frame,
|
||||||
CefRefPtr<CefStreamReader> stream,
|
CefRefPtr<CefStreamReader> stream,
|
||||||
const CefString& url) {
|
const CefString& url) {
|
||||||
DCHECK(stream.get() != NULL);
|
DCHECK(stream.get() != NULL);
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_LoadHTMLForStreamRef, frame, stream, url));
|
base::Bind(&CefBrowserImpl::UIT_LoadHTMLForStreamRef, this, frame, stream,
|
||||||
|
url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::ExecuteJavaScript(CefRefPtr<CefFrame> frame,
|
void CefBrowserImpl::ExecuteJavaScript(CefRefPtr<CefFrame> frame,
|
||||||
const CefString& jsCode,
|
const CefString& jsCode,
|
||||||
const CefString& scriptUrl,
|
const CefString& scriptUrl,
|
||||||
int startLine) {
|
int startLine) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&CefBrowserImpl::UIT_ExecuteJavaScript, frame, jsCode, scriptUrl,
|
base::Bind(&CefBrowserImpl::UIT_ExecuteJavaScript, this, frame, jsCode,
|
||||||
startLine));
|
scriptUrl, startLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 CefBrowserImpl::GetIdentifier(CefRefPtr<CefFrame> frame) {
|
int64 CefBrowserImpl::GetIdentifier(CefRefPtr<CefFrame> frame) {
|
||||||
@ -1565,8 +1580,9 @@ void CefFrameImpl::VisitDOM(CefRefPtr<CefDOMVisitor> visitor) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CefRefPtr<CefFrame> framePtr(this);
|
CefRefPtr<CefFrame> framePtr(this);
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
browser_.get(), &CefBrowserImpl::UIT_VisitDOM, framePtr, visitor));
|
base::Bind(&CefBrowserImpl::UIT_VisitDOM, browser_.get(), framePtr,
|
||||||
|
visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefV8Context> CefFrameImpl::GetV8Context() {
|
CefRefPtr<CefV8Context> CefFrameImpl::GetV8Context() {
|
||||||
|
@ -777,7 +777,7 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
|
|
||||||
virtual void OnSSLCertificateError(net::URLRequest* request,
|
virtual void OnSSLCertificateError(net::URLRequest* request,
|
||||||
const net::SSLInfo& ssl_info,
|
const net::SSLInfo& ssl_info,
|
||||||
bool is_hsts_host) OVERRIDE {
|
bool fatal) OVERRIDE {
|
||||||
// Allow all certificate errors.
|
// Allow all certificate errors.
|
||||||
request->ContinueDespiteLastError();
|
request->ContinueDespiteLastError();
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) {
|
|||||||
web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled;
|
web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled;
|
||||||
web.threaded_compositing_enabled = cef.threaded_compositing_enabled;
|
web.threaded_compositing_enabled = cef.threaded_compositing_enabled;
|
||||||
web.accelerated_layers_enabled = !cef.accelerated_layers_disabled;
|
web.accelerated_layers_enabled = !cef.accelerated_layers_disabled;
|
||||||
|
web.accelerated_animation_enabled = !cef.accelerated_layers_disabled;
|
||||||
web.accelerated_video_enabled = !cef.accelerated_video_disabled;
|
web.accelerated_video_enabled = !cef.accelerated_video_disabled;
|
||||||
web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled;
|
web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled;
|
||||||
web.accelerated_painting_enabled = !cef.accelerated_painting_disabled;
|
web.accelerated_painting_enabled = !cef.accelerated_painting_disabled;
|
||||||
|
@ -69,7 +69,6 @@
|
|||||||
#include "webkit/glue/weburlrequest_extradata_impl.h"
|
#include "webkit/glue/weburlrequest_extradata_impl.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
#include "webkit/glue/window_open_disposition.h"
|
#include "webkit/glue/window_open_disposition.h"
|
||||||
#include "webkit/media/video_renderer_impl.h"
|
|
||||||
#include "webkit/media/webmediaplayer_impl.h"
|
#include "webkit/media/webmediaplayer_impl.h"
|
||||||
#include "webkit/plugins/npapi/plugin_list.h"
|
#include "webkit/plugins/npapi/plugin_list.h"
|
||||||
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
|
#include "webkit/plugins/npapi/webplugin_delegate_impl.h"
|
||||||
@ -665,17 +664,15 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer(
|
|||||||
collection->AddAudioRenderer(new media::ReferenceAudioRenderer(
|
collection->AddAudioRenderer(new media::ReferenceAudioRenderer(
|
||||||
_Context->process()->ui_thread()->audio_manager()));
|
_Context->process()->ui_thread()->audio_manager()));
|
||||||
|
|
||||||
scoped_ptr<webkit_media::WebMediaPlayerImpl> result(
|
return new webkit_media::WebMediaPlayerImpl(
|
||||||
new webkit_media::WebMediaPlayerImpl(
|
frame,
|
||||||
client,
|
client,
|
||||||
base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
|
base::WeakPtr<webkit_media::WebMediaPlayerDelegate>(),
|
||||||
collection.release(),
|
collection.release(),
|
||||||
|
NULL,
|
||||||
message_loop_factory.release(),
|
message_loop_factory.release(),
|
||||||
NULL,
|
NULL,
|
||||||
new media::MediaLog()));
|
new media::MediaLog());
|
||||||
if (!result->Initialize(frame, false))
|
|
||||||
return NULL;
|
|
||||||
return result.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost(
|
WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost(
|
||||||
|
@ -204,7 +204,7 @@ void CefContext::Shutdown() {
|
|||||||
|
|
||||||
// Finish shutdown on the UI thread.
|
// Finish shutdown on the UI thread.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &CefContext::UIT_FinishShutdown,
|
base::Bind(&CefContext::UIT_FinishShutdown, this,
|
||||||
&browser_shutdown_event, &uithread_shutdown_event));
|
&browser_shutdown_event, &uithread_shutdown_event));
|
||||||
|
|
||||||
// Block until browser shutdown is complete.
|
// Block until browser shutdown is complete.
|
||||||
@ -273,7 +273,7 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser) {
|
|||||||
webkit_glue::ClearCache();
|
webkit_glue::ClearCache();
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(webkit_glue::ClearCache));
|
base::Bind(webkit_glue::ClearCache));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ void CefContext::InitializeResourceBundle() {
|
|||||||
|
|
||||||
std::string locale_str = locale();
|
std::string locale_str = locale();
|
||||||
const std::string loaded_locale =
|
const std::string loaded_locale =
|
||||||
ui::ResourceBundle::InitSharedInstance(locale_str);
|
ui::ResourceBundle::InitSharedInstanceWithLocale(locale_str);
|
||||||
CHECK(!loaded_locale.empty()) << "Locale could not be found for " <<
|
CHECK(!loaded_locale.empty()) << "Locale could not be found for " <<
|
||||||
locale_str;
|
locale_str;
|
||||||
|
|
||||||
|
@ -31,29 +31,6 @@ class CefThreadMessageLoopProxy : public MessageLoopProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MessageLoopProxy implementation.
|
// MessageLoopProxy implementation.
|
||||||
virtual bool PostTask(const tracked_objects::Location& from_here,
|
|
||||||
Task* task) OVERRIDE {
|
|
||||||
return CefThread::PostTask(id_, from_here, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
|
|
||||||
Task* task, int64 delay_ms) OVERRIDE {
|
|
||||||
return CefThread::PostDelayedTask(id_, from_here, task, delay_ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
|
|
||||||
Task* task) OVERRIDE {
|
|
||||||
return CefThread::PostNonNestableTask(id_, from_here, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool PostNonNestableDelayedTask(
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms) OVERRIDE {
|
|
||||||
return CefThread::PostNonNestableDelayedTask(id_, from_here, task,
|
|
||||||
delay_ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool PostTask(const tracked_objects::Location& from_here,
|
virtual bool PostTask(const tracked_objects::Location& from_here,
|
||||||
const base::Closure& task) OVERRIDE {
|
const base::Closure& task) OVERRIDE {
|
||||||
return CefThread::PostTask(id_, from_here, task);
|
return CefThread::PostTask(id_, from_here, task);
|
||||||
@ -168,38 +145,6 @@ bool CefThread::CurrentlyOn(ID identifier) {
|
|||||||
cef_threads_[identifier]->message_loop() == MessageLoop::current();
|
cef_threads_[identifier]->message_loop() == MessageLoop::current();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefThread::PostTask(ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task) {
|
|
||||||
return PostTaskHelper(identifier, from_here, task, 0, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefThread::PostDelayedTask(ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms) {
|
|
||||||
return PostTaskHelper(identifier, from_here, task, delay_ms, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefThread::PostNonNestableTask(
|
|
||||||
ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task) {
|
|
||||||
return PostTaskHelper(identifier, from_here, task, 0, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefThread::PostNonNestableDelayedTask(
|
|
||||||
ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms) {
|
|
||||||
return PostTaskHelper(identifier, from_here, task, delay_ms, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool CefThread::PostTask(ID identifier,
|
bool CefThread::PostTask(ID identifier,
|
||||||
const tracked_objects::Location& from_here,
|
const tracked_objects::Location& from_here,
|
||||||
@ -254,47 +199,6 @@ scoped_refptr<MessageLoopProxy> CefThread::GetMessageLoopProxyForThread(
|
|||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefThread::PostTaskHelper(
|
|
||||||
ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms,
|
|
||||||
bool nestable) {
|
|
||||||
DCHECK(identifier >= 0 && identifier < ID_COUNT);
|
|
||||||
// Optimization: to avoid unnecessary locks, we listed the ID enumeration in
|
|
||||||
// order of lifetime. So no need to lock if we know that the other thread
|
|
||||||
// outlives this one.
|
|
||||||
// Note: since the array is so small, ok to loop instead of creating a map,
|
|
||||||
// which would require a lock because std::map isn't thread safe, defeating
|
|
||||||
// the whole purpose of this optimization.
|
|
||||||
ID current_thread;
|
|
||||||
bool guaranteed_to_outlive_target_thread =
|
|
||||||
GetCurrentThreadIdentifier(¤t_thread) &&
|
|
||||||
current_thread >= identifier;
|
|
||||||
|
|
||||||
if (!guaranteed_to_outlive_target_thread)
|
|
||||||
lock_.Acquire();
|
|
||||||
|
|
||||||
MessageLoop* message_loop = cef_threads_[identifier] ?
|
|
||||||
cef_threads_[identifier]->message_loop() : NULL;
|
|
||||||
if (message_loop) {
|
|
||||||
if (nestable) {
|
|
||||||
message_loop->PostDelayedTask(from_here, task, delay_ms);
|
|
||||||
} else {
|
|
||||||
message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete task;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!guaranteed_to_outlive_target_thread)
|
|
||||||
lock_.Release();
|
|
||||||
|
|
||||||
return !!message_loop;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool CefThread::PostTaskHelper(
|
bool CefThread::PostTaskHelper(
|
||||||
ID identifier,
|
ID identifier,
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "base/task.h"
|
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
@ -71,37 +70,11 @@ class CefThread : public base::Thread {
|
|||||||
|
|
||||||
virtual ~CefThread();
|
virtual ~CefThread();
|
||||||
|
|
||||||
// These methods are the same as in message_loop.h, but are guaranteed to
|
// These are the same methods in message_loop.h, but are guaranteed to either
|
||||||
// either post the Task to the MessageLoop (if it's still alive), or to
|
// get posted to the MessageLoop if it's still alive, or be deleted otherwise.
|
||||||
// delete the Task otherwise.
|
// They return true iff the thread existed and the task was posted. Note that
|
||||||
// They return true if the thread existed and the task was posted. Note that
|
// even if the task is posted, there's no guarantee that it will run, since
|
||||||
// even if the task is posted, there's no guarantee that it will run; for
|
// the target thread may already have a Quit message in its queue.
|
||||||
// example the target loop may already be quitting, or in the case of a
|
|
||||||
// delayed task a Quit message may preempt it in the message loop queue.
|
|
||||||
// Conversely, a return value of false is a guarantee the task will not run.
|
|
||||||
static bool PostTask(ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task);
|
|
||||||
static bool PostDelayedTask(ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms);
|
|
||||||
static bool PostNonNestableTask(ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task);
|
|
||||||
static bool PostNonNestableDelayedTask(
|
|
||||||
ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms);
|
|
||||||
|
|
||||||
// TODO(ajwong): Remove the functions above once the Task -> Closure migration
|
|
||||||
// is complete.
|
|
||||||
//
|
|
||||||
// There are 2 sets of Post*Task functions, one which takes the older Task*
|
|
||||||
// function object representation, and one that takes the newer base::Closure.
|
|
||||||
// We have this overload to allow a staged transition between the two systems.
|
|
||||||
// Once the transition is done, the functions above should be deleted.
|
|
||||||
static bool PostTask(ID identifier,
|
static bool PostTask(ID identifier,
|
||||||
const tracked_objects::Location& from_here,
|
const tracked_objects::Location& from_here,
|
||||||
const base::Closure& task);
|
const base::Closure& task);
|
||||||
@ -121,17 +94,17 @@ class CefThread : public base::Thread {
|
|||||||
template <class T>
|
template <class T>
|
||||||
static bool DeleteSoon(ID identifier,
|
static bool DeleteSoon(ID identifier,
|
||||||
const tracked_objects::Location& from_here,
|
const tracked_objects::Location& from_here,
|
||||||
T* object) {
|
const T* object) {
|
||||||
return PostNonNestableTask(
|
return GetMessageLoopProxyForThread(identifier)->DeleteSoon(
|
||||||
identifier, from_here, new DeleteTask<T>(object));
|
from_here, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static bool ReleaseSoon(ID identifier,
|
static bool ReleaseSoon(ID identifier,
|
||||||
const tracked_objects::Location& from_here,
|
const tracked_objects::Location& from_here,
|
||||||
T* object) {
|
const T* object) {
|
||||||
return PostNonNestableTask(
|
return GetMessageLoopProxyForThread(identifier)->ReleaseSoon(
|
||||||
identifier, from_here, new ReleaseTask<T>(object));
|
from_here, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callable on any thread. Returns whether the given ID corresponds to a well
|
// Callable on any thread. Returns whether the given ID corresponds to a well
|
||||||
@ -193,13 +166,6 @@ class CefThread : public base::Thread {
|
|||||||
// Common initialization code for the constructors.
|
// Common initialization code for the constructors.
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
static bool PostTaskHelper(
|
|
||||||
ID identifier,
|
|
||||||
const tracked_objects::Location& from_here,
|
|
||||||
Task* task,
|
|
||||||
int64 delay_ms,
|
|
||||||
bool nestable);
|
|
||||||
|
|
||||||
static bool PostTaskHelper(
|
static bool PostTaskHelper(
|
||||||
ID identifier,
|
ID identifier,
|
||||||
const tracked_objects::Location& from_here,
|
const tracked_objects::Location& from_here,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
#include "libcef/cef_time_util.h"
|
#include "libcef/cef_time_util.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "net/base/cookie_monster.h"
|
#include "net/base/cookie_monster.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -115,7 +116,7 @@ bool CefVisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return CefThread::PostTask(CefThread::IO, FROM_HERE,
|
return CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableFunction(IOT_VisitAllCookies, visitor));
|
base::Bind(IOT_VisitAllCookies, visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefVisitUrlCookies(const CefString& url, bool includeHttpOnly,
|
bool CefVisitUrlCookies(const CefString& url, bool includeHttpOnly,
|
||||||
@ -132,7 +133,7 @@ bool CefVisitUrlCookies(const CefString& url, bool includeHttpOnly,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
return CefThread::PostTask(CefThread::IO, FROM_HERE,
|
return CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableFunction(IOT_VisitUrlCookies, gurl, includeHttpOnly, visitor));
|
base::Bind(IOT_VisitUrlCookies, gurl, includeHttpOnly, visitor));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefSetCookie(const CefString& url, const CefCookie& cookie) {
|
bool CefSetCookie(const CefString& url, const CefCookie& cookie) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "libcef/dom_storage_context.h"
|
#include "libcef/dom_storage_context.h"
|
||||||
#include "libcef/dom_storage_namespace.h"
|
#include "libcef/dom_storage_namespace.h"
|
||||||
|
|
||||||
#include "base/task.h"
|
#include "base/logging.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||||
|
@ -60,7 +60,12 @@ class DOMStorageArea {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined(COMPILER_GCC)
|
#if defined(COMPILER_GCC)
|
||||||
|
#if defined(OS_ANDROID)
|
||||||
|
// Android stlport uses std namespace
|
||||||
|
namespace std {
|
||||||
|
#else
|
||||||
namespace __gnu_cxx {
|
namespace __gnu_cxx {
|
||||||
|
#endif
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct hash<DOMStorageArea*> {
|
struct hash<DOMStorageArea*> {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "libcef/browser_impl.h"
|
#include "libcef/browser_impl.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "net/base/file_stream.h"
|
#include "net/base/file_stream.h"
|
||||||
@ -91,8 +92,7 @@ void DragDownloadFile::InitiateDownload() {
|
|||||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this,
|
base::Bind(&DragDownloadFile::InitiateDownload, this));
|
||||||
&DragDownloadFile::InitiateDownload));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -111,9 +111,7 @@ void DragDownloadFile::DownloadCompleted(bool is_successful) {
|
|||||||
if (drag_message_loop_ != MessageLoop::current()) {
|
if (drag_message_loop_ != MessageLoop::current()) {
|
||||||
drag_message_loop_->PostTask(
|
drag_message_loop_->PostTask(
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
NewRunnableMethod(this,
|
base::Bind(&DragDownloadFile::DownloadCompleted, this, is_successful));
|
||||||
&DragDownloadFile::DownloadCompleted,
|
|
||||||
is_successful));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
#include "libcef/drag_download_util.h"
|
#include "libcef/drag_download_util.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/task.h"
|
|
||||||
#include "base/string_number_conversions.h"
|
#include "base/string_number_conversions.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "googleurl/src/gurl.h"
|
#include "googleurl/src/gurl.h"
|
||||||
@ -101,13 +101,13 @@ void PromiseFileFinalizer::Cleanup() {
|
|||||||
void PromiseFileFinalizer::OnDownloadCompleted(const FilePath& file_path) {
|
void PromiseFileFinalizer::OnDownloadCompleted(const FilePath& file_path) {
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &PromiseFileFinalizer::Cleanup));
|
base::Bind(&PromiseFileFinalizer::Cleanup, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PromiseFileFinalizer::OnDownloadAborted() {
|
void PromiseFileFinalizer::OnDownloadAborted() {
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &PromiseFileFinalizer::Cleanup));
|
base::Bind(&PromiseFileFinalizer::Cleanup, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace drag_download_util
|
} // namespace drag_download_util
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "libcef/cef_context.h"
|
#include "libcef/cef_context.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/string_split.h"
|
#include "base/string_split.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
#include "webkit/plugins/npapi/plugin_list.h"
|
#include "webkit/plugins/npapi/plugin_list.h"
|
||||||
@ -56,8 +57,8 @@ void UIT_RegisterPlugin(CefPluginInfo* plugin_info) {
|
|||||||
entry_points.np_initialize = plugin_info->np_initialize;
|
entry_points.np_initialize = plugin_info->np_initialize;
|
||||||
entry_points.np_shutdown = plugin_info->np_shutdown;
|
entry_points.np_shutdown = plugin_info->np_shutdown;
|
||||||
|
|
||||||
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
|
webkit::npapi::PluginList::Singleton()->RegisterInternalPluginWithEntryPoints(
|
||||||
info, entry_points, true);
|
info, true, entry_points);
|
||||||
|
|
||||||
delete plugin_info;
|
delete plugin_info;
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ bool CefRegisterPlugin(const CefPluginInfo& plugin_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(UIT_RegisterPlugin, new CefPluginInfo(plugin_info)));
|
base::Bind(UIT_RegisterPlugin, new CefPluginInfo(plugin_info)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "libcef/cef_context.h"
|
#include "libcef/cef_context.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
|
||||||
@ -40,8 +41,8 @@ bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin,
|
|||||||
allow_target_subdomains);
|
allow_target_subdomains);
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(&CefAddCrossOriginWhitelistEntry, source_origin,
|
base::Bind(base::IgnoreResult(&CefAddCrossOriginWhitelistEntry),
|
||||||
target_protocol, target_domain,
|
source_origin, target_protocol, target_domain,
|
||||||
allow_target_subdomains));
|
allow_target_subdomains));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +76,8 @@ bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin,
|
|||||||
allow_target_subdomains);
|
allow_target_subdomains);
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(&CefRemoveCrossOriginWhitelistEntry, source_origin,
|
base::Bind(base::IgnoreResult(&CefRemoveCrossOriginWhitelistEntry),
|
||||||
target_protocol, target_domain,
|
source_origin, target_protocol, target_domain,
|
||||||
allow_target_subdomains));
|
allow_target_subdomains));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ bool CefClearCrossOriginWhitelist() {
|
|||||||
WebSecurityPolicy::resetOriginAccessWhitelists();
|
WebSecurityPolicy::resetOriginAccessWhitelists();
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(&CefClearCrossOriginWhitelist));
|
base::Bind(base::IgnoreResult(&CefClearCrossOriginWhitelist)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "libcef/request_impl.h"
|
#include "libcef/request_impl.h"
|
||||||
#include "libcef/response_impl.h"
|
#include "libcef/response_impl.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
@ -285,7 +286,7 @@ class CefUrlRequestJob : public net::URLRequestJob {
|
|||||||
} else {
|
} else {
|
||||||
// Execute this method on the IO thread.
|
// Execute this method on the IO thread.
|
||||||
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableMethod(this, &Callback::HeadersAvailable));
|
base::Bind(&Callback::HeadersAvailable, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +316,7 @@ class CefUrlRequestJob : public net::URLRequestJob {
|
|||||||
} else {
|
} else {
|
||||||
// Execute this method on the IO thread.
|
// Execute this method on the IO thread.
|
||||||
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableMethod(this, &Callback::BytesAvailable));
|
base::Bind(&Callback::BytesAvailable, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +328,7 @@ class CefUrlRequestJob : public net::URLRequestJob {
|
|||||||
} else {
|
} else {
|
||||||
// Execute this method on the IO thread.
|
// Execute this method on the IO thread.
|
||||||
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableMethod(this, &Callback::Cancel));
|
base::Bind(&Callback::Cancel, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,8 +605,8 @@ bool CefRegisterCustomScheme(const CefString& scheme_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableFunction(&CefRegisterCustomScheme, scheme_name, is_standard,
|
base::Bind(base::IgnoreResult(&CefRegisterCustomScheme), scheme_name,
|
||||||
is_local, is_display_isolated));
|
is_standard, is_local, is_display_isolated));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -626,8 +627,8 @@ bool CefRegisterSchemeHandlerFactory(
|
|||||||
factory);
|
factory);
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableFunction(&CefRegisterSchemeHandlerFactory, scheme_name,
|
base::Bind(base::IgnoreResult(&CefRegisterSchemeHandlerFactory),
|
||||||
domain_name, factory));
|
scheme_name, domain_name, factory));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,7 +647,7 @@ bool CefClearSchemeHandlerFactories() {
|
|||||||
RegisterDevToolsSchemeHandler(false);
|
RegisterDevToolsSchemeHandler(false);
|
||||||
} else {
|
} else {
|
||||||
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
CefThread::PostTask(CefThread::IO, FROM_HERE,
|
||||||
NewRunnableFunction(&CefClearSchemeHandlerFactories));
|
base::Bind(base::IgnoreResult(&CefClearSchemeHandlerFactories)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "include/cef_task.h"
|
#include "include/cef_task.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
#include "base/bind.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -27,24 +28,13 @@ bool CefCurrentlyOn(CefThreadId threadId) {
|
|||||||
return CefThread::CurrentlyOn(static_cast<CefThread::ID>(id));
|
return CefThread::CurrentlyOn(static_cast<CefThread::ID>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
class CefTaskHelper : public Task {
|
|
||||||
public:
|
|
||||||
CefTaskHelper(CefRefPtr<CefTask> task, CefThreadId threadId)
|
|
||||||
: task_(task), thread_id_(threadId) {}
|
|
||||||
virtual void Run() { task_->Execute(thread_id_); }
|
|
||||||
private:
|
|
||||||
CefRefPtr<CefTask> task_;
|
|
||||||
CefThreadId thread_id_;
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefTaskHelper);
|
|
||||||
};
|
|
||||||
|
|
||||||
bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
||||||
int id = GetThreadId(threadId);
|
int id = GetThreadId(threadId);
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return CefThread::PostTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
return CefThread::PostTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
||||||
new CefTaskHelper(task, threadId));
|
base::Bind(&CefTask::Execute, task, threadId));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task,
|
bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task,
|
||||||
@ -54,5 +44,5 @@ bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
return CefThread::PostDelayedTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
return CefThread::PostDelayedTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
||||||
new CefTaskHelper(task, threadId), delay_ms);
|
base::Bind(&CefTask::Execute, task, threadId), delay_ms);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "libcef/browser_impl.h"
|
#include "libcef/browser_impl.h"
|
||||||
#include "libcef/cef_context.h"
|
#include "libcef/cef_context.h"
|
||||||
#include "libcef/tracker.h"
|
#include "libcef/tracker.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||||
@ -345,8 +347,8 @@ bool CefRegisterExtension(const CefString& extension_name,
|
|||||||
ExtensionWrapper* wrapper = new ExtensionWrapper(name->GetString(),
|
ExtensionWrapper* wrapper = new ExtensionWrapper(name->GetString(),
|
||||||
code->GetString(), handler.get());
|
code->GetString(), handler.get());
|
||||||
|
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(wrapper,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
&ExtensionWrapper::UIT_RegisterExtension));
|
base::Bind(&ExtensionWrapper::UIT_RegisterExtension, wrapper));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/sys_string_conversions.h"
|
#include "base/sys_string_conversions.h"
|
||||||
#include "base/task.h"
|
|
||||||
#include "base/threading/thread.h"
|
#include "base/threading/thread.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
@ -74,45 +73,17 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) {
|
|||||||
return file_name;
|
return file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This class's sole task is to write out data for a promised file; the caller
|
// This helper's sole task is to write out data for a promised file; the caller
|
||||||
// is responsible for opening the file.
|
// is responsible for opening the file. It takes the drop data and an open file
|
||||||
class PromiseWriterTask : public Task {
|
// stream.
|
||||||
public:
|
void PromiseWriterHelper(const WebDropData& drop_data,
|
||||||
// Assumes ownership of file_stream.
|
net::FileStream* file_stream) {
|
||||||
PromiseWriterTask(const WebDropData& drop_data,
|
DCHECK(file_stream);
|
||||||
FileStream* file_stream);
|
file_stream->Write(drop_data.file_contents.data(),
|
||||||
virtual ~PromiseWriterTask();
|
drop_data.file_contents.length(),
|
||||||
virtual void Run();
|
|
||||||
|
|
||||||
private:
|
|
||||||
WebDropData drop_data_;
|
|
||||||
|
|
||||||
// This class takes ownership of file_stream_ and will close and delete it.
|
|
||||||
scoped_ptr<FileStream> file_stream_;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Takes the drop data and an open file stream (which it takes ownership of and
|
|
||||||
// will close and delete).
|
|
||||||
PromiseWriterTask::PromiseWriterTask(const WebDropData& drop_data,
|
|
||||||
FileStream* file_stream) :
|
|
||||||
drop_data_(drop_data) {
|
|
||||||
file_stream_.reset(file_stream);
|
|
||||||
DCHECK(file_stream_.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
PromiseWriterTask::~PromiseWriterTask() {
|
|
||||||
DCHECK(file_stream_.get());
|
|
||||||
if (file_stream_.get())
|
|
||||||
file_stream_->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PromiseWriterTask::Run() {
|
|
||||||
CHECK(file_stream_.get());
|
|
||||||
file_stream_->Write(drop_data_.file_contents.data(),
|
|
||||||
drop_data_.file_contents.length(),
|
|
||||||
net::CompletionCallback());
|
net::CompletionCallback());
|
||||||
|
|
||||||
// Let our destructor take care of business.
|
file_stream->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -368,7 +339,7 @@ void PromiseWriterTask::Run() {
|
|||||||
} else {
|
} else {
|
||||||
// The writer will take care of closing and deletion.
|
// The writer will take care of closing and deletion.
|
||||||
CefThread::PostTask(CefThread::FILE, FROM_HERE,
|
CefThread::PostTask(CefThread::FILE, FROM_HERE,
|
||||||
new PromiseWriterTask(*dropData_, fileStream));
|
base::Bind(PromiseWriterHelper, *dropData_, base::Owned(fileStream)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once we've created the file, we should return the file name.
|
// Once we've created the file, we should return the file name.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "libcef/web_drag_utils_win.h"
|
#include "libcef/web_drag_utils_win.h"
|
||||||
#include "libcef/cef_thread.h"
|
#include "libcef/cef_thread.h"
|
||||||
|
|
||||||
#include "base/task.h"
|
#include "base/bind.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ void WebDragSource::OnDragSourceCancel() {
|
|||||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &WebDragSource::OnDragSourceCancel));
|
base::Bind(&WebDragSource::OnDragSourceCancel, this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ void WebDragSource::OnDragSourceDrop() {
|
|||||||
// OnDragSourceDrop after the current task.
|
// OnDragSourceDrop after the current task.
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &WebDragSource::DelayedOnDragSourceDrop));
|
base::Bind(&WebDragSource::DelayedOnDragSourceDrop, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebDragSource::DelayedOnDragSourceDrop() {
|
void WebDragSource::DelayedOnDragSourceDrop() {
|
||||||
@ -86,7 +86,7 @@ void WebDragSource::OnDragSourceMove() {
|
|||||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
CefThread::PostTask(
|
CefThread::PostTask(
|
||||||
CefThread::UI, FROM_HERE,
|
CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &WebDragSource::OnDragSourceMove));
|
base::Bind(&WebDragSource::OnDragSourceMove, this));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "libcef/request_impl.h"
|
#include "libcef/request_impl.h"
|
||||||
#include "libcef/response_impl.h"
|
#include "libcef/response_impl.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "googleurl/src/gurl.h"
|
#include "googleurl/src/gurl.h"
|
||||||
@ -241,8 +242,7 @@ CefWebURLRequest::CreateWebURLRequest(
|
|||||||
|
|
||||||
// Send the request from the UI thread.
|
// Send the request from the UI thread.
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(requester.get(), &CefWebURLRequestImpl::DoSend,
|
base::Bind(&CefWebURLRequestImpl::DoSend, requester.get(), request));
|
||||||
request));
|
|
||||||
|
|
||||||
return requester.get();
|
return requester.get();
|
||||||
}
|
}
|
||||||
@ -266,7 +266,7 @@ CefWebURLRequestImpl::RequestState CefWebURLRequestImpl::GetState() {
|
|||||||
|
|
||||||
void CefWebURLRequestImpl::Cancel() {
|
void CefWebURLRequestImpl::Cancel() {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
NewRunnableMethod(this, &CefWebURLRequestImpl::DoCancel));
|
base::Bind(&CefWebURLRequestImpl::DoCancel, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebURLRequestImpl::DoSend(CefRefPtr<CefRequest> request) {
|
void CefWebURLRequestImpl::DoSend(CefRefPtr<CefRequest> request) {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/task.h"
|
|
||||||
#include "base/time.h"
|
#include "base/time.h"
|
||||||
#include "skia/ext/platform_canvas.h"
|
#include "skia/ext/platform_canvas.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
||||||
|
@ -21,11 +21,6 @@ patches = [
|
|||||||
'name': 'tools_gyp',
|
'name': 'tools_gyp',
|
||||||
'path': '../tools/gyp/',
|
'path': '../tools/gyp/',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
# https://bugs.webkit.org/show_bug.cgi?id=73273
|
|
||||||
'name': 'webcore_v8_custom',
|
|
||||||
'path': '../third_party/WebKit/Source/WebCore/bindings/v8/custom/'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
# https://bugs.webkit.org/show_bug.cgi?id=73760
|
# https://bugs.webkit.org/show_bug.cgi?id=73760
|
||||||
'name': 'webcore_cachedresource',
|
'name': 'webcore_cachedresource',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
Index: message_loop.cc
|
Index: message_loop.cc
|
||||||
===================================================================
|
===================================================================
|
||||||
--- message_loop.cc (revision 115322)
|
--- message_loop.cc (revision 119867)
|
||||||
+++ message_loop.cc (working copy)
|
+++ message_loop.cc (working copy)
|
||||||
@@ -395,9 +395,13 @@
|
@@ -362,9 +362,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLoop::AssertIdle() const {
|
void MessageLoop::AssertIdle() const {
|
||||||
@ -19,9 +19,9 @@ Index: message_loop.cc
|
|||||||
bool MessageLoop::is_running() const {
|
bool MessageLoop::is_running() const {
|
||||||
Index: message_loop.h
|
Index: message_loop.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- message_loop.h (revision 115322)
|
--- message_loop.h (revision 119867)
|
||||||
+++ message_loop.h (working copy)
|
+++ message_loop.h (working copy)
|
||||||
@@ -353,6 +353,9 @@
|
@@ -345,6 +345,9 @@
|
||||||
// Asserts that the MessageLoop is "idle".
|
// Asserts that the MessageLoop is "idle".
|
||||||
void AssertIdle() const;
|
void AssertIdle() const;
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
Index: V8DOMWindowCustom.cpp
|
|
||||||
===================================================================
|
|
||||||
--- V8DOMWindowCustom.cpp (revision 103399)
|
|
||||||
+++ V8DOMWindowCustom.cpp (working copy)
|
|
||||||
@@ -297,8 +297,11 @@
|
|
||||||
static v8::Handle<v8::Value> handlePostMessageCallback(const v8::Arguments& args, bool extendedTransfer)
|
|
||||||
{
|
|
||||||
DOMWindow* window = V8DOMWindow::toNative(args.Holder());
|
|
||||||
+ Frame* frame = V8Proxy::retrieveFrameForCallingContext();
|
|
||||||
+ if (!frame)
|
|
||||||
+ return v8::Undefined();
|
|
||||||
|
|
||||||
- DOMWindow* source = V8Proxy::retrieveFrameForCallingContext()->domWindow();
|
|
||||||
+ DOMWindow* source = frame->domWindow();
|
|
||||||
ASSERT(source->frame());
|
|
||||||
|
|
||||||
// This function has variable arguments and can be:
|
|
Reference in New Issue
Block a user