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

Side by Side Diff: third_party/WebKit/Source/modules/nfc/NFC.cpp

Issue 2218533002: Backporting JSONValues from protocol::Values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch back to partition allocator Created 4 years, 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/nfc/NFC.h" 5 #include "modules/nfc/NFC.h"
6 6
7 #include "bindings/core/v8/JSONValuesForV8.h" 7 #include "bindings/core/v8/JSONValuesForV8.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "bindings/core/v8/V8ArrayBuffer.h" 9 #include "bindings/core/v8/V8ArrayBuffer.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (value->IsNumber()) 171 if (value->IsNumber())
172 return mojo::WTFArray<uint8_t>::From(WTF::String::number(value.As<v8 ::Number>()->Value())); 172 return mojo::WTFArray<uint8_t>::From(WTF::String::number(value.As<v8 ::Number>()->Value()));
173 173
174 if (value->IsString()) { 174 if (value->IsString()) {
175 blink::V8StringResource<> stringResource = value; 175 blink::V8StringResource<> stringResource = value;
176 if (stringResource.prepare()) 176 if (stringResource.prepare())
177 return mojo::WTFArray<uint8_t>::From<WTF::String>(stringResource ); 177 return mojo::WTFArray<uint8_t>::From<WTF::String>(stringResource );
178 } 178 }
179 179
180 if (value->IsObject() && !value->IsArrayBuffer()) { 180 if (value->IsObject() && !value->IsArrayBuffer()) {
181 RefPtr<blink::JSONValue> jsonResult = blink::toJSONValue(scriptValue .context(), value); 181 std::unique_ptr<blink::JSONValue> jsonResult = blink::toJSONValue(sc riptValue.context(), value);
182 if (jsonResult && (jsonResult->getType() == blink::JSONValue::TypeOb ject)) 182 if (jsonResult && (jsonResult->getType() == blink::JSONValue::TypeOb ject))
183 return mojo::WTFArray<uint8_t>::From(jsonResult->toJSONString()) ; 183 return mojo::WTFArray<uint8_t>::From(jsonResult->toJSONString()) ;
184 } 184 }
185 185
186 if (value->IsArrayBuffer()) 186 if (value->IsArrayBuffer())
187 return mojo::WTFArray<uint8_t>::From(blink::V8ArrayBuffer::toImpl(va lue.As<v8::Object>())); 187 return mojo::WTFArray<uint8_t>::From(blink::V8ArrayBuffer::toImpl(va lue.As<v8::Object>()));
188 188
189 return nullptr; 189 return nullptr;
190 } 190 }
191 }; 191 };
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 } 580 }
581 581
582 DEFINE_TRACE(NFC) 582 DEFINE_TRACE(NFC)
583 { 583 {
584 PageVisibilityObserver::trace(visitor); 584 PageVisibilityObserver::trace(visitor);
585 ContextLifecycleObserver::trace(visitor); 585 ContextLifecycleObserver::trace(visitor);
586 visitor->trace(m_requests); 586 visitor->trace(m_requests);
587 } 587 }
588 588
589 } // namespace blink 589 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698