Revision: 18058
Author:   [email protected]
Date:     Mon Nov 25 14:30:59 2013 UTC
Log: Add versions with an Isolate parameter for inlined API methods that need one

We shouldn't have APIs that call Isolate::GetCurrent() internally. This
change removes all remaining occurrences of inlined methods in v8.h

BUG=none
[email protected]
LOG=n

Review URL: https://codereview.chromium.org/85693002
http://code.google.com/p/v8/source/detail?r=18058

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Fri Nov 22 14:23:32 2013 UTC
+++ /branches/bleeding_edge/include/v8.h        Mon Nov 25 14:30:59 2013 UTC
@@ -1524,6 +1524,8 @@
 class V8_EXPORT Boolean : public Primitive {
  public:
   bool Value() const;
+  V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value);
+  // Will be deprecated soon.
   V8_INLINE static Handle<Boolean> New(bool value);
 };

@@ -3094,6 +3096,8 @@
   /** Adds a property to each instance created by this template.*/
   void Set(Handle<String> name, Handle<Data> value,
            PropertyAttribute attributes = None);
+ V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value);
+  // Will be deprecated soon.
   V8_INLINE void Set(const char* name, Handle<Data> value);

   void SetAccessorProperty(
@@ -6029,16 +6033,25 @@
 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
   return resource_is_shared_cross_origin_;
 }
+
+
+Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
+  return value ? True(isolate) : False(isolate);
+}


 Handle<Boolean> Boolean::New(bool value) {
-  Isolate* isolate = Isolate::GetCurrent();
-  return value ? True(isolate) : False(isolate);
+  return Boolean::New(Isolate::GetCurrent(), value);
+}
+
+
+void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) {
+  Set(v8::String::NewFromUtf8(isolate, name), value);
 }


 void Template::Set(const char* name, v8::Handle<Data> value) {
-  Set(v8::String::NewFromUtf8(Isolate::GetCurrent(), name), value);
+  Set(Isolate::GetCurrent(), name, value);
 }


=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Nov 22 12:28:58 2013 UTC
+++ /branches/bleeding_edge/src/debug.cc        Mon Nov 25 14:30:59 2013 UTC
@@ -3137,7 +3137,7 @@
     v8::Local<v8::Function> fun =
         v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));

-    v8::Handle<v8::Boolean> running = v8::Boolean::New(auto_continue);
+ v8::Handle<v8::Boolean> running = v8::Boolean::New(isolate, auto_continue);
     static const int kArgc = 1;
     v8::Handle<Value> argv[kArgc] = { running };
     cmd_processor = v8::Local<v8::Object>::Cast(
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Fri Nov 22 12:43:17 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Nov 25 14:30:59 2013 UTC
@@ -1631,7 +1631,7 @@
   LocalContext env;
   v8::HandleScope scope(env->GetIsolate());

-  Local<Value> primitive_false = Boolean::New(false);
+  Local<Value> primitive_false = Boolean::New(env->GetIsolate(), false);
   CHECK(primitive_false->IsBoolean());
   CHECK(!primitive_false->IsBooleanObject());
   CHECK(!primitive_false->BooleanValue());
@@ -1654,7 +1654,7 @@
   CHECK(!false_boolean_object->IsTrue());
   CHECK(!false_boolean_object->IsFalse());

-  Local<Value> primitive_true = Boolean::New(true);
+  Local<Value> primitive_true = Boolean::New(env->GetIsolate(), true);
   CHECK(primitive_true->IsBoolean());
   CHECK(!primitive_true->IsBooleanObject());
   CHECK(primitive_true->BooleanValue());
@@ -2625,7 +2625,7 @@
   CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(env->GetIsolate(),
"over the lazy dog."));
   CheckEmbedderData(&env, 1, v8::Number::New(1.2345));
-  CheckEmbedderData(&env, 0, v8::Boolean::New(true));
+  CheckEmbedderData(&env, 0, v8::Boolean::New(env->GetIsolate(), true));
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to