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 24 matching lines...) Expand all Loading... |
35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 v8::Local<v8::Value> ScriptValue::v8Value() const { | 39 v8::Local<v8::Value> ScriptValue::v8Value() const { |
40 if (isEmpty()) | 40 if (isEmpty()) |
41 return v8::Local<v8::Value>(); | 41 return v8::Local<v8::Value>(); |
42 | 42 |
43 ASSERT(isolate()->InContext()); | 43 ASSERT(isolate()->InContext()); |
44 | 44 |
45 // This is a check to validate that you don't return a ScriptValue to a world
different | 45 // This is a check to validate that you don't return a ScriptValue to a world |
46 // from the world that created the ScriptValue. | 46 // different from the world that created the ScriptValue. |
47 // Probably this could be: | 47 // Probably this could be: |
48 // if (&m_scriptState->world() == &DOMWrapperWorld::current(isolate())) | 48 // if (&m_scriptState->world() == &DOMWrapperWorld::current(isolate())) |
49 // return v8::Local<v8::Value>(); | 49 // return v8::Local<v8::Value>(); |
50 // instead of triggering RELEASE_ASSERT. | 50 // instead of triggering RELEASE_ASSERT. |
51 RELEASE_ASSERT(&m_scriptState->world() == | 51 RELEASE_ASSERT(&m_scriptState->world() == |
52 &DOMWrapperWorld::current(isolate())); | 52 &DOMWrapperWorld::current(isolate())); |
53 return m_value->newLocal(isolate()); | 53 return m_value->newLocal(isolate()); |
54 } | 54 } |
55 | 55 |
56 v8::Local<v8::Value> ScriptValue::v8ValueFor( | 56 v8::Local<v8::Value> ScriptValue::v8ValueFor( |
(...skipping 21 matching lines...) Expand all Loading... |
78 return false; | 78 return false; |
79 result = toCoreString(v8::Local<v8::String>::Cast(string)); | 79 result = toCoreString(v8::Local<v8::String>::Cast(string)); |
80 return true; | 80 return true; |
81 } | 81 } |
82 | 82 |
83 ScriptValue ScriptValue::createNull(ScriptState* scriptState) { | 83 ScriptValue ScriptValue::createNull(ScriptState* scriptState) { |
84 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); | 84 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); |
85 } | 85 } |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
OLD | NEW |