Skip to content

Commit efdc156

Browse files
rogerwangCong Liu
authored andcommitted
move setting embedder data of Node from blink
together with be948af in Blink, Fix nwjs#2996 Conflicts: src/renderer/shell_content_renderer_client.cc
1 parent d67b470 commit efdc156

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/renderer/shell_content_renderer_client.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
6363
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
6464
#include "third_party/WebKit/public/web/WebView.h"
65+
#include "gin/public/context_holder.h"
66+
#include "gin/public/gin_embedders.h"
67+
6568
//#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
6669
#include "content/common/dom_storage/dom_storage_map.h"
6770

@@ -233,6 +236,15 @@ void ShellContentRendererClient::DidCreateScriptContext(
233236
VLOG(1) << "DidCreateScriptContext: " << url;
234237
InstallNodeSymbols(frame, context, url);
235238
creating_first_context_ = false;
239+
240+
#if 1 //defined(NW_IMPLEMENTATION)
241+
v8::Local<v8::Context> node_context =
242+
v8::Local<v8::Context>::New(context->GetIsolate(), node::g_context);
243+
//need to stay sync with V8PerContextData.h
244+
int v8ContextPerContextDataIndex = static_cast<int>(gin::kPerContextDataStartIndex + gin::kEmbedderBlink);
245+
node_context->SetAlignedPointerInEmbedderData(v8ContextPerContextDataIndex,
246+
context->GetAlignedPointerFromEmbedderData(v8ContextPerContextDataIndex));
247+
#endif
236248
}
237249

238250
bool ShellContentRendererClient::goodForNode(blink::WebFrame* frame)

0 commit comments

Comments
 (0)