mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 187216.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1136 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -79,6 +79,7 @@ class CefV8IsolateManager {
|
||||
scoped_refptr<CefV8ContextState> GetContextState(
|
||||
v8::Handle<v8::Context> context) {
|
||||
DCHECK_EQ(isolate_, v8::Isolate::GetCurrent());
|
||||
DCHECK(context.IsEmpty() || isolate_ == context->GetIsolate());
|
||||
|
||||
if (context_safety_impl_ == IMPL_DISABLED)
|
||||
return scoped_refptr<CefV8ContextState>();
|
||||
@ -103,7 +104,9 @@ class CefV8IsolateManager {
|
||||
} else {
|
||||
if (context_state_key_.IsEmpty()) {
|
||||
context_state_key_ =
|
||||
v8::Persistent<v8::String>::New(v8::String::New(kCefContextState));
|
||||
v8::Persistent<v8::String>::New(
|
||||
isolate_,
|
||||
v8::String::New(kCefContextState));
|
||||
}
|
||||
|
||||
v8::Handle<v8::Object> object = context->Global();
|
||||
@ -184,6 +187,7 @@ class CefV8IsolateManager {
|
||||
worker_url_ = worker_url;
|
||||
}
|
||||
|
||||
v8::Isolate* isolate() const { return isolate_; }
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner() const {
|
||||
return task_runner_;
|
||||
}
|
||||
@ -397,11 +401,13 @@ class CefV8MakeWeakParam {
|
||||
};
|
||||
|
||||
// Callback for weak persistent reference destruction.
|
||||
void TrackDestructor(v8::Persistent<v8::Value> object, void* parameter) {
|
||||
void TrackDestructor(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Value> object,
|
||||
void* parameter) {
|
||||
if (parameter)
|
||||
delete static_cast<CefV8MakeWeakParam*>(parameter);
|
||||
|
||||
object.Dispose();
|
||||
object.Dispose(isolate);
|
||||
object.Clear();
|
||||
}
|
||||
|
||||
@ -817,6 +823,8 @@ bool CefV8HandleBase::BelongsToCurrentThread() const {
|
||||
CefV8HandleBase::CefV8HandleBase(v8::Handle<v8::Context> context) {
|
||||
CefV8IsolateManager* manager = GetIsolateManager();
|
||||
DCHECK(manager);
|
||||
|
||||
isolate_ = manager->isolate();
|
||||
task_runner_ = manager->task_runner();
|
||||
context_state_ = manager->GetContextState(context);
|
||||
}
|
||||
@ -1011,17 +1019,17 @@ WebKit::WebFrame* CefV8ContextImpl::GetWebFrame() {
|
||||
// CefV8ValueImpl::Handle
|
||||
|
||||
CefV8ValueImpl::Handle::~Handle() {
|
||||
// Persist the |tracker_| object (call MakeWeak) if:
|
||||
// A. The value represents an Object or Function, and
|
||||
// B. The handle has been passed into a V8 function or used as a return value
|
||||
// Persist the handle (call MakeWeak) if:
|
||||
// A. The handle has been passed into a V8 function or used as a return value
|
||||
// from a V8 callback, and
|
||||
// C. The associated context, if any, is still valid.
|
||||
if (tracker_ && tracker_should_persist_ &&
|
||||
(!context_state_.get() || context_state_->IsValid())) {
|
||||
handle_.MakeWeak(new CefV8MakeWeakParam(context_state_, tracker_),
|
||||
TrackDestructor);
|
||||
// B. The associated context, if any, is still valid.
|
||||
if (should_persist_ && (!context_state_.get() || context_state_->IsValid())) {
|
||||
handle_.MakeWeak(
|
||||
isolate(),
|
||||
(tracker_ ? new CefV8MakeWeakParam(context_state_, tracker_) : NULL),
|
||||
TrackDestructor);
|
||||
} else {
|
||||
handle_.Dispose();
|
||||
handle_.Dispose(isolate());
|
||||
handle_.Clear();
|
||||
|
||||
if (tracker_)
|
||||
|
Reference in New Issue
Block a user