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

Side by Side Diff: Source/bindings/v8/ScriptValue.h

Issue 23450039: Pass isolate to ScriptValue constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptString.h ('k') | Source/bindings/v8/ScriptValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class MessagePort; 53 class MessagePort;
54 class SerializedScriptValue; 54 class SerializedScriptValue;
55 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; 55 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
56 typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray; 56 typedef Vector<RefPtr<WTF::ArrayBuffer>, 1> ArrayBufferArray;
57 57
58 class ScriptValue { 58 class ScriptValue {
59 public: 59 public:
60 ScriptValue() { } 60 ScriptValue() { }
61 virtual ~ScriptValue(); 61 virtual ~ScriptValue();
62 62
63 ScriptValue(v8::Handle<v8::Value> value) 63 ScriptValue(v8::Handle<v8::Value> value, v8::Isolate* isolate)
64 : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(valu e, v8::Isolate::GetCurrent())) 64 : m_value(value.IsEmpty() ? 0 : SharedPersistent<v8::Value>::create(valu e, isolate))
65 { 65 {
66 } 66 }
67 67
68 ScriptValue(const ScriptValue& value) 68 ScriptValue(const ScriptValue& value)
69 : m_value(value.m_value) 69 : m_value(value.m_value)
70 { 70 {
71 } 71 }
72 72
73 static ScriptValue createNull() { return ScriptValue(v8::Null()); } 73 static ScriptValue createNull()
74 static ScriptValue createBoolean(bool b) { return ScriptValue(b ? v8::True() : v8::False()); } 74 {
75 v8::Isolate* isolate = v8::Isolate::GetCurrent();
76 return ScriptValue(v8::Null(isolate), isolate);
77 }
78 static ScriptValue createBoolean(bool b)
79 {
80 v8::Isolate* isolate = v8::Isolate::GetCurrent();
81 return ScriptValue(b ? v8::True(isolate) : v8::False(isolate), isolate);
82 }
75 83
76 ScriptValue& operator=(const ScriptValue& value) 84 ScriptValue& operator=(const ScriptValue& value)
77 { 85 {
78 if (this != &value) 86 if (this != &value)
79 m_value = value.m_value; 87 m_value = value.m_value;
80 return *this; 88 return *this;
81 } 89 }
82 90
83 bool operator==(const ScriptValue& value) const 91 bool operator==(const ScriptValue& value) const
84 { 92 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 169
162 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; 170 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const;
163 171
164 private: 172 private:
165 RefPtr<SharedPersistent<v8::Value> > m_value; 173 RefPtr<SharedPersistent<v8::Value> > m_value;
166 }; 174 };
167 175
168 } // namespace WebCore 176 } // namespace WebCore
169 177
170 #endif // ScriptValue_h 178 #endif // ScriptValue_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptString.h ('k') | Source/bindings/v8/ScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698