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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/core/v8/ScriptValue.h" | 32 #include "bindings/core/v8/ScriptValue.h" |
33 | 33 |
34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
36 #include "platform/JSONValues.h" | 36 #include "platform/JSONValues.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 int ScriptValue::identityHash() const | |
41 { | |
42 if (isEmpty()) | |
43 return 0; | |
44 v8::Local<v8::Value> value = m_value->newLocal(isolate()); | |
yurys
2014/10/03 15:08:05
There should be a HandleScope.
aandrey
2014/10/06 10:52:56
Done.
| |
45 if (!value->IsObject()) | |
46 return 0; | |
47 return v8::Local<v8::Object>::Cast(value)->GetIdentityHash(); | |
48 } | |
49 | |
40 v8::Handle<v8::Value> ScriptValue::v8Value() const | 50 v8::Handle<v8::Value> ScriptValue::v8Value() const |
41 { | 51 { |
42 if (isEmpty()) | 52 if (isEmpty()) |
43 return v8::Handle<v8::Value>(); | 53 return v8::Handle<v8::Value>(); |
44 | 54 |
45 ASSERT(isolate()->InContext()); | 55 ASSERT(isolate()->InContext()); |
46 | 56 |
47 // This is a check to validate that you don't return a ScriptValue to a worl d different | 57 // This is a check to validate that you don't return a ScriptValue to a worl d different |
48 // from the world that created the ScriptValue. | 58 // from the world that created the ScriptValue. |
49 // Probably this could be: | 59 // Probably this could be: |
(...skipping 25 matching lines...) Expand all Loading... | |
75 } | 85 } |
76 | 86 |
77 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const | 87 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const |
78 { | 88 { |
79 ASSERT(!scriptState->contextIsValid()); | 89 ASSERT(!scriptState->contextIsValid()); |
80 ScriptState::Scope scope(scriptState); | 90 ScriptState::Scope scope(scriptState); |
81 return v8ToJSONValue(scriptState->isolate(), v8Value(), JSONValue::maxDepth) ; | 91 return v8ToJSONValue(scriptState->isolate(), v8Value(), JSONValue::maxDepth) ; |
82 } | 92 } |
83 | 93 |
84 } // namespace blink | 94 } // namespace blink |
OLD | NEW |