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

Side by Side Diff: Source/WebCore/bindings/v8/ScriptValue.cpp

Issue 12926003: Merge 144458 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « Source/WebCore/bindings/v8/ScriptValue.h ('k') | Source/WebCore/bindings/v8/SharedPersistent.h » ('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, 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 29 matching lines...) Expand all
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 ScriptValue::~ScriptValue() 43 ScriptValue::~ScriptValue()
44 { 44 {
45 } 45 }
46 46
47 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptStat e) 47 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptStat e)
48 { 48 {
49 ScriptScope scope(scriptState); 49 ScriptScope scope(scriptState);
50 return SerializedScriptValue::create(v8Value()); 50 return SerializedScriptValue::create(v8ValueRaw());
51 } 51 }
52 52
53 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptStat e, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThro w) 53 PassRefPtr<SerializedScriptValue> ScriptValue::serialize(ScriptState* scriptStat e, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThro w)
54 { 54 {
55 ScriptScope scope(scriptState); 55 ScriptScope scope(scriptState);
56 return SerializedScriptValue::create(v8Value(), messagePorts, arrayBuffers, didThrow); 56 return SerializedScriptValue::create(v8ValueRaw(), messagePorts, arrayBuffer s, didThrow);
57 } 57 }
58 58
59 ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptV alue* value) 59 ScriptValue ScriptValue::deserialize(ScriptState* scriptState, SerializedScriptV alue* value)
60 { 60 {
61 ScriptScope scope(scriptState); 61 ScriptScope scope(scriptState);
62 return ScriptValue(value->deserialize()); 62 return ScriptValue(value->deserialize());
63 } 63 }
64 64
65 bool ScriptValue::getString(String& result) const 65 bool ScriptValue::getString(String& result) const
66 { 66 {
67 if (m_value.isEmpty()) 67 if (hasNoValue())
68 return false; 68 return false;
69 69
70 if (!m_value->IsString()) 70 if (!v8ValueRaw()->IsString())
71 return false; 71 return false;
72 72
73 result = toWebCoreString(m_value.get()); 73 result = toWebCoreString(v8ValueRaw());
74 return true; 74 return true;
75 } 75 }
76 76
77 String ScriptValue::toString(ScriptState*) const 77 String ScriptValue::toString(ScriptState*) const
78 { 78 {
79 v8::TryCatch block; 79 v8::TryCatch block;
80 v8::Handle<v8::String> string = m_value->ToString(); 80 v8::Handle<v8::String> string = v8ValueRaw()->ToString();
81 if (block.HasCaught()) 81 if (block.HasCaught())
82 return String(); 82 return String();
83 return v8StringToWebCoreString<String>(string, DoNotExternalize); 83 return v8StringToWebCoreString<String>(string, DoNotExternalize);
84 } 84 }
85 85
86 #if ENABLE(INSPECTOR) 86 #if ENABLE(INSPECTOR)
87 static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value , int maxDepth) 87 static PassRefPtr<InspectorValue> v8ToInspectorValue(v8::Handle<v8::Value> value , int maxDepth)
88 { 88 {
89 if (value.IsEmpty()) { 89 if (value.IsEmpty()) {
90 ASSERT_NOT_REACHED(); 90 ASSERT_NOT_REACHED();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 ASSERT_NOT_REACHED(); 136 ASSERT_NOT_REACHED();
137 return 0; 137 return 0;
138 } 138 }
139 139
140 PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptStat e) const 140 PassRefPtr<InspectorValue> ScriptValue::toInspectorValue(ScriptState* scriptStat e) const
141 { 141 {
142 v8::HandleScope handleScope; 142 v8::HandleScope handleScope;
143 // v8::Object::GetPropertyNames() expects current context to be not null. 143 // v8::Object::GetPropertyNames() expects current context to be not null.
144 v8::Context::Scope contextScope(scriptState->context()); 144 v8::Context::Scope contextScope(scriptState->context());
145 return v8ToInspectorValue(m_value.get(), InspectorValue::maxDepth); 145 return v8ToInspectorValue(v8ValueRaw(), InspectorValue::maxDepth);
146 } 146 }
147 #endif 147 #endif
148 148
149 } // namespace WebCore 149 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/v8/ScriptValue.h ('k') | Source/WebCore/bindings/v8/SharedPersistent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698