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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptValue.cpp

Issue 2017893002: [Binding] [Refactoring] Use SerializedScriptValue class as external interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error Created 4 years, 6 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 | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con st 56 v8::Local<v8::Value> ScriptValue::v8ValueFor(ScriptState* targetScriptState) con st
57 { 57 {
58 if (isEmpty()) 58 if (isEmpty())
59 return v8::Local<v8::Value>(); 59 return v8::Local<v8::Value>();
60 v8::Isolate* isolate = targetScriptState->isolate(); 60 v8::Isolate* isolate = targetScriptState->isolate();
61 if (&m_scriptState->world() == &targetScriptState->world()) 61 if (&m_scriptState->world() == &targetScriptState->world())
62 return m_value->newLocal(isolate); 62 return m_value->newLocal(isolate);
63 63
64 ASSERT(isolate->InContext()); 64 ASSERT(isolate->InContext());
65 v8::Local<v8::Value> value = m_value->newLocal(isolate); 65 v8::Local<v8::Value> value = m_value->newLocal(isolate);
66 RefPtr<SerializedScriptValue> serialized = SerializedScriptValueFactory::ins tance().createAndSwallowExceptions(isolate, value); 66 RefPtr<SerializedScriptValue> serialized = SerializedScriptValue::serializeA ndSwallowExceptions(isolate, value);
67 return serialized->deserialize(); 67 return serialized->deserialize();
68 } 68 }
69 69
70 bool ScriptValue::toString(String& result) const 70 bool ScriptValue::toString(String& result) const
71 { 71 {
72 if (isEmpty()) 72 if (isEmpty())
73 return false; 73 return false;
74 74
75 ScriptState::Scope scope(m_scriptState.get()); 75 ScriptState::Scope scope(m_scriptState.get());
76 v8::Local<v8::Value> string = v8Value(); 76 v8::Local<v8::Value> string = v8Value();
77 if (string.IsEmpty() || !string->IsString()) 77 if (string.IsEmpty() || !string->IsString())
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 { 84 {
85 return ScriptValue(scriptState, v8::Null(scriptState->isolate())); 85 return ScriptValue(scriptState, v8::Null(scriptState->isolate()));
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698