mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 100584.
- Add a new CefSettings.graphics_implementation option for using different GL implementations. - Disable accelerated compositing by default due to multiple issues (issue #334, issue #335, issue #337). - Eliminate the "patcher" project and perform all patching during GYP project generation. - Fix references to non-existent files in cef.gyp. - Move BrowserWebKitInit method implementations to a separate .cc file. - Add support for Flash on Mac (issue #305). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@284 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "cef_thread.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop_proxy.h"
|
||||
|
||||
@@ -27,28 +28,53 @@ class CefThreadMessageLoopProxy : public MessageLoopProxy {
|
||||
|
||||
// MessageLoopProxy implementation.
|
||||
virtual bool PostTask(const tracked_objects::Location& from_here,
|
||||
Task* task) {
|
||||
Task* task) OVERRIDE {
|
||||
return CefThread::PostTask(id_, from_here, task);
|
||||
}
|
||||
|
||||
virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
|
||||
Task* task, int64 delay_ms) {
|
||||
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) {
|
||||
Task* task) OVERRIDE {
|
||||
return CefThread::PostNonNestableTask(id_, from_here, task);
|
||||
}
|
||||
|
||||
virtual bool PostNonNestableDelayedTask(
|
||||
const tracked_objects::Location& from_here,
|
||||
Task* task,
|
||||
int64 delay_ms) {
|
||||
int64 delay_ms) OVERRIDE {
|
||||
return CefThread::PostNonNestableDelayedTask(id_, from_here, task,
|
||||
delay_ms);
|
||||
}
|
||||
virtual bool BelongsToCurrentThread() {
|
||||
|
||||
virtual bool PostTask(const tracked_objects::Location& from_here,
|
||||
const base::Closure& task) OVERRIDE {
|
||||
return CefThread::PostTask(id_, from_here, task);
|
||||
}
|
||||
|
||||
virtual bool PostDelayedTask(const tracked_objects::Location& from_here,
|
||||
const base::Closure& task,
|
||||
int64 delay_ms) OVERRIDE {
|
||||
return CefThread::PostDelayedTask(id_, from_here, task, delay_ms);
|
||||
}
|
||||
|
||||
virtual bool PostNonNestableTask(const tracked_objects::Location& from_here,
|
||||
const base::Closure& task) OVERRIDE {
|
||||
return CefThread::PostNonNestableTask(id_, from_here, task);
|
||||
}
|
||||
|
||||
virtual bool PostNonNestableDelayedTask(
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& task,
|
||||
int64 delay_ms) OVERRIDE {
|
||||
return CefThread::PostNonNestableDelayedTask(id_, from_here, task,
|
||||
delay_ms);
|
||||
}
|
||||
|
||||
virtual bool BelongsToCurrentThread() OVERRIDE {
|
||||
return CefThread::CurrentlyOn(id_);
|
||||
}
|
||||
|
||||
@@ -117,16 +143,16 @@ bool CefThread::CurrentlyOn(ID identifier) {
|
||||
|
||||
// static
|
||||
bool CefThread::PostTask(ID identifier,
|
||||
const tracked_objects::Location& from_here,
|
||||
Task* task) {
|
||||
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) {
|
||||
const tracked_objects::Location& from_here,
|
||||
Task* task,
|
||||
int64 delay_ms) {
|
||||
return PostTaskHelper(identifier, from_here, task, delay_ms, true);
|
||||
}
|
||||
|
||||
@@ -147,6 +173,38 @@ bool CefThread::PostNonNestableDelayedTask(
|
||||
return PostTaskHelper(identifier, from_here, task, delay_ms, false);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefThread::PostTask(ID identifier,
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& task) {
|
||||
return PostTaskHelper(identifier, from_here, task, 0, true);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefThread::PostDelayedTask(ID identifier,
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& 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,
|
||||
const base::Closure& task) {
|
||||
return PostTaskHelper(identifier, from_here, task, 0, false);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefThread::PostNonNestableDelayedTask(
|
||||
ID identifier,
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& task,
|
||||
int64 delay_ms) {
|
||||
return PostTaskHelper(identifier, from_here, task, delay_ms, false);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefThread::GetCurrentThreadIdentifier(ID* identifier) {
|
||||
MessageLoop* cur_message_loop = MessageLoop::current();
|
||||
@@ -208,3 +266,42 @@ bool CefThread::PostTaskHelper(
|
||||
|
||||
return !!message_loop;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
bool CefThread::PostTaskHelper(
|
||||
ID identifier,
|
||||
const tracked_objects::Location& from_here,
|
||||
const base::Closure& 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);
|
||||
}
|
||||
}
|
||||
|
||||
if (!guaranteed_to_outlive_target_thread)
|
||||
lock_.Release();
|
||||
|
||||
return !!message_loop;
|
||||
}
|
||||
|
Reference in New Issue
Block a user