OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // This is a check to validate that you don't return a ScriptValue to a worl
d different | 48 // This is a check to validate that you don't return a ScriptValue to a worl
d different |
49 // from the world that created the ScriptValue. | 49 // from the world that created the ScriptValue. |
50 // Probably this could be: | 50 // Probably this could be: |
51 // if (&m_scriptState->world() == &DOMWrapperWorld::current(isolate())) | 51 // if (&m_scriptState->world() == &DOMWrapperWorld::current(isolate())) |
52 // return v8::Local<v8::Value>(); | 52 // return v8::Local<v8::Value>(); |
53 // instead of triggering RELEASE_ASSERT. | 53 // instead of triggering RELEASE_ASSERT. |
54 RELEASE_ASSERT(&m_scriptState->world() == &DOMWrapperWorld::current(isolate(
))); | 54 RELEASE_ASSERT(&m_scriptState->world() == &DOMWrapperWorld::current(isolate(
))); |
55 return m_value->newLocal(isolate()); | 55 return m_value->newLocal(isolate()); |
56 } | 56 } |
57 | 57 |
58 v8::Local<v8::Value> ScriptValue::v8ValueUnsafe() const | |
59 { | |
60 if (isEmpty()) | |
61 return v8::Local<v8::Value>(); | |
62 return m_value->newLocal(isolate()); | |
63 } | |
64 | |
65 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con
st | 58 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con
st |
66 { | 59 { |
67 if (isEmpty()) | 60 if (isEmpty()) |
68 return v8::Local<v8::Value>(); | 61 return v8::Local<v8::Value>(); |
69 v8::Isolate* isolate = targetScriptState->isolate(); | 62 v8::Isolate* isolate = targetScriptState->isolate(); |
70 if (&m_scriptState->world() == &targetScriptState->world()) | 63 if (&m_scriptState->world() == &targetScriptState->world()) |
71 return m_value->newLocal(isolate); | 64 return m_value->newLocal(isolate); |
72 | 65 |
73 ASSERT(isolate->InContext()); | 66 ASSERT(isolate->InContext()); |
74 v8::Local<v8::Value> value = m_value->newLocal(isolate); | 67 v8::Local<v8::Value> value = m_value->newLocal(isolate); |
(...skipping 13 matching lines...) Expand all Loading... |
88 result = toCoreString(v8::Local<v8::String>::Cast(string)); | 81 result = toCoreString(v8::Local<v8::String>::Cast(string)); |
89 return true; | 82 return true; |
90 } | 83 } |
91 | 84 |
92 ScriptValue ScriptValue::createNull(ScriptState* scriptState) | 85 ScriptValue ScriptValue::createNull(ScriptState* scriptState) |
93 { | 86 { |
94 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); | 87 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); |
95 } | 88 } |
96 | 89 |
97 } // namespace blink | 90 } // namespace blink |
OLD | NEW |