Notify client each time main context is created
This commit is contained in:
parent
c5e68ec165
commit
5da4f032c3
1 changed files with 7 additions and 18 deletions
|
@ -66,8 +66,6 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||||
: content::RenderFrameObserver(frame),
|
: content::RenderFrameObserver(frame),
|
||||||
render_frame_(frame),
|
render_frame_(frame),
|
||||||
isolated_world_(isolated_world),
|
isolated_world_(isolated_world),
|
||||||
main_context_created_(false),
|
|
||||||
isolated_context_created_(false),
|
|
||||||
renderer_client_(renderer_client) {}
|
renderer_client_(renderer_client) {}
|
||||||
|
|
||||||
// content::RenderFrameObserver:
|
// content::RenderFrameObserver:
|
||||||
|
@ -92,20 +90,13 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||||
void DidCreateScriptContext(v8::Handle<v8::Context> context,
|
void DidCreateScriptContext(v8::Handle<v8::Context> context,
|
||||||
int extension_group,
|
int extension_group,
|
||||||
int world_id) override {
|
int world_id) override {
|
||||||
if (!main_context_created_ && IsMainWorld(world_id)) {
|
bool notify_client =
|
||||||
main_context_created_ = true;
|
isolated_world_ ? IsIsolatedWorld(world_id) : IsMainWorld(world_id);
|
||||||
if (isolated_world_) {
|
if (notify_client)
|
||||||
CreateIsolatedWorldContext();
|
|
||||||
} else {
|
|
||||||
renderer_client_->DidCreateScriptContext(context, render_frame_);
|
renderer_client_->DidCreateScriptContext(context, render_frame_);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isolated_world_ && !isolated_context_created_
|
if (isolated_world_ && IsMainWorld(world_id))
|
||||||
&& IsIsolatedWorld(world_id)) {
|
CreateIsolatedWorldContext();
|
||||||
isolated_context_created_ = true;
|
|
||||||
renderer_client_->DidCreateScriptContext(context, render_frame_);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||||
|
@ -123,8 +114,6 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||||
private:
|
private:
|
||||||
content::RenderFrame* render_frame_;
|
content::RenderFrame* render_frame_;
|
||||||
bool isolated_world_;
|
bool isolated_world_;
|
||||||
bool main_context_created_;
|
|
||||||
bool isolated_context_created_;
|
|
||||||
AtomRendererClient* renderer_client_;
|
AtomRendererClient* renderer_client_;
|
||||||
|
|
||||||
const int kMainWorldId = 0;
|
const int kMainWorldId = 0;
|
||||||
|
|
Loading…
Reference in a new issue