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

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

Issue 242223004: Rename macros TONATIVE_BOOL* and TOSTRING_BOOL to *_DEFAULT (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix comment Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptEventListener.cpp ('k') | Source/bindings/v8/V8Binding.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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 v8::Local<v8::Array> propertyNames = object->GetPropertyNames(); 93 v8::Local<v8::Array> propertyNames = object->GetPropertyNames();
94 uint32_t length = propertyNames->Length(); 94 uint32_t length = propertyNames->Length();
95 for (uint32_t i = 0; i < length; i++) { 95 for (uint32_t i = 0; i < length; i++) {
96 v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(isolat e, i)); 96 v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(isolat e, i));
97 // FIXME(yurys): v8::Object should support GetOwnPropertyNames 97 // FIXME(yurys): v8::Object should support GetOwnPropertyNames
98 if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8: :String>::Cast(name))) 98 if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8: :String>::Cast(name)))
99 continue; 99 continue;
100 RefPtr<JSONValue> propertyValue = v8ToJSONValue(object->Get(name), m axDepth, isolate); 100 RefPtr<JSONValue> propertyValue = v8ToJSONValue(object->Get(name), m axDepth, isolate);
101 if (!propertyValue) 101 if (!propertyValue)
102 return nullptr; 102 return nullptr;
103 TOSTRING_BOOL(V8StringResource<WithNullCheck>, nameString, name, nul lptr); 103 TOSTRING_DEFAULT(V8StringResource<WithNullCheck>, nameString, name, nullptr);
104 jsonObject->setValue(nameString, propertyValue); 104 jsonObject->setValue(nameString, propertyValue);
105 } 105 }
106 return jsonObject; 106 return jsonObject;
107 } 107 }
108 ASSERT_NOT_REACHED(); 108 ASSERT_NOT_REACHED();
109 return nullptr; 109 return nullptr;
110 } 110 }
111 111
112 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const 112 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const
113 { 113 {
114 v8::HandleScope handleScope(scriptState->isolate()); 114 v8::HandleScope handleScope(scriptState->isolate());
115 // v8::Object::GetPropertyNames() expects current context to be not null. 115 // v8::Object::GetPropertyNames() expects current context to be not null.
116 v8::Context::Scope contextScope(scriptState->context()); 116 v8::Context::Scope contextScope(scriptState->context());
117 return v8ToJSONValue(v8Value(), JSONValue::maxDepth, scriptState->isolate()) ; 117 return v8ToJSONValue(v8Value(), JSONValue::maxDepth, scriptState->isolate()) ;
118 } 118 }
119 119
120 } // namespace WebCore 120 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptEventListener.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698