Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/d8.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: DEPRECATE_SOON(GetInternalField) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 731fdb373528761b0ccd26c37096b100e22b6eb8..720eb6f9ddfc544ad678df7781fdde976828b30d 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -226,15 +226,14 @@ static Local<Value> Throw(Isolate* isolate, const char* message) {
.ToLocalChecked());
}
-
-Worker* GetWorkerFromInternalField(Isolate* isolate, Local<Object> object) {
- if (object->InternalFieldCount() != 1) {
+Worker* GetWorkerFromEmbedderField(Isolate* isolate, Local<Object> object) {
+ if (object->EmbedderFieldCount() != 1) {
Throw(isolate, "this is not a Worker");
return NULL;
}
Worker* worker =
- static_cast<Worker*>(object->GetAlignedPointerFromInternalField(0));
+ static_cast<Worker*>(object->GetAlignedPointerFromEmbedderField(0));
if (worker == NULL) {
Throw(isolate, "Worker is defunct because main thread is terminating");
return NULL;
@@ -1147,15 +1146,15 @@ void Shell::WorkerNew(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
- // Initialize the internal field to NULL; if we return early without
+ // Initialize the embedder field to NULL; if we return early without
// creating a new Worker (because the main thread is terminating) we can
// early-out from the instance calls.
- args.Holder()->SetAlignedPointerInInternalField(0, NULL);
+ args.Holder()->SetAlignedPointerInEmbedderField(0, NULL);
if (!allow_new_workers_) return;
Worker* worker = new Worker;
- args.Holder()->SetAlignedPointerInInternalField(0, worker);
+ args.Holder()->SetAlignedPointerInEmbedderField(0, worker);
workers_.Add(worker);
String::Utf8Value script(args[0]);
@@ -1177,7 +1176,7 @@ void Shell::WorkerPostMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
- Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
+ Worker* worker = GetWorkerFromEmbedderField(isolate, args.Holder());
if (!worker) {
return;
}
@@ -1196,7 +1195,7 @@ void Shell::WorkerPostMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
- Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
+ Worker* worker = GetWorkerFromEmbedderField(isolate, args.Holder());
if (!worker) {
return;
}
@@ -1214,7 +1213,7 @@ void Shell::WorkerGetMessage(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::WorkerTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = args.GetIsolate();
HandleScope handle_scope(isolate);
- Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
+ Worker* worker = GetWorkerFromEmbedderField(isolate, args.Holder());
if (!worker) {
return;
}
@@ -1566,7 +1565,7 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
.ToLocalChecked(),
FunctionTemplate::New(isolate, WorkerGetMessage, Local<Value>(),
worker_signature));
- worker_fun_template->InstanceTemplate()->SetInternalFieldCount(1);
+ worker_fun_template->InstanceTemplate()->SetEmbedderFieldCount(1);
global_template->Set(
String::NewFromUtf8(isolate, "Worker", NewStringType::kNormal)
.ToLocalChecked(),
« include/v8-experimental.h ('K') | « src/crankshaft/hydrogen.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698