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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/serialization/V8ScriptValueSerializerForModules.cpp

Issue 2297043002: Web expose FileSystemFileEntry, FileSystemDirectoryEntry and friends (Closed)
Patch Set: Rebased Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "bindings/modules/v8/serialization/V8ScriptValueSerializerForModules.h" 5 #include "bindings/modules/v8/serialization/V8ScriptValueSerializerForModules.h"
6 6
7 #include "bindings/core/v8/ScriptWrappable.h" 7 #include "bindings/core/v8/ScriptWrappable.h"
8 #include "bindings/modules/v8/V8CryptoKey.h" 8 #include "bindings/modules/v8/V8CryptoKey.h"
9 #include "bindings/modules/v8/V8DOMFileSystem.h" 9 #include "bindings/modules/v8/V8FileSystem.h"
10 #include "bindings/modules/v8/V8RTCCertificate.h" 10 #include "bindings/modules/v8/V8RTCCertificate.h"
11 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h" 11 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h"
12 #include "platform/FileSystemType.h" 12 #include "platform/FileSystemType.h"
13 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
14 #include "public/platform/WebCrypto.h" 14 #include "public/platform/WebCrypto.h"
15 #include "public/platform/WebCryptoKey.h" 15 #include "public/platform/WebCryptoKey.h"
16 #include "public/platform/WebCryptoKeyAlgorithm.h" 16 #include "public/platform/WebCryptoKeyAlgorithm.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 bool V8ScriptValueSerializerForModules::writeDOMObject( 20 bool V8ScriptValueSerializerForModules::writeDOMObject(
21 ScriptWrappable* wrappable, 21 ScriptWrappable* wrappable,
22 ExceptionState& exceptionState) { 22 ExceptionState& exceptionState) {
23 // Give the core/ implementation a chance to try first. 23 // Give the core/ implementation a chance to try first.
24 // If it didn't recognize the kind of wrapper, try the modules types. 24 // If it didn't recognize the kind of wrapper, try the modules types.
25 if (V8ScriptValueSerializer::writeDOMObject(wrappable, exceptionState)) 25 if (V8ScriptValueSerializer::writeDOMObject(wrappable, exceptionState))
26 return true; 26 return true;
27 if (exceptionState.hadException()) 27 if (exceptionState.hadException())
28 return false; 28 return false;
29 29
30 const WrapperTypeInfo* wrapperTypeInfo = wrappable->wrapperTypeInfo(); 30 const WrapperTypeInfo* wrapperTypeInfo = wrappable->wrapperTypeInfo();
31 if (wrapperTypeInfo == &V8CryptoKey::wrapperTypeInfo) { 31 if (wrapperTypeInfo == &V8CryptoKey::wrapperTypeInfo) {
32 return writeCryptoKey(wrappable->toImpl<CryptoKey>()->key(), 32 return writeCryptoKey(wrappable->toImpl<CryptoKey>()->key(),
33 exceptionState); 33 exceptionState);
34 } 34 }
35 if (wrapperTypeInfo == &V8DOMFileSystem::wrapperTypeInfo) { 35 if (wrapperTypeInfo == &V8FileSystem::wrapperTypeInfo) {
36 DOMFileSystem* fs = wrappable->toImpl<DOMFileSystem>(); 36 FileSystem* fs = wrappable->toImpl<FileSystem>();
37 if (!fs->clonable()) { 37 if (!fs->clonable()) {
38 exceptionState.throwDOMException( 38 exceptionState.throwDOMException(
39 DataCloneError, "A FileSystem object could not be cloned."); 39 DataCloneError, "A FileSystem object could not be cloned.");
40 return false; 40 return false;
41 } 41 }
42 writeTag(DOMFileSystemTag); 42 writeTag(FileSystemTag);
43 // This locks in the values of the FileSystemType enumerators. 43 // This locks in the values of the FileSystemType enumerators.
44 writeUint32(static_cast<uint32_t>(fs->type())); 44 writeUint32(static_cast<uint32_t>(fs->type()));
45 writeUTF8String(fs->name()); 45 writeUTF8String(fs->name());
46 writeUTF8String(fs->rootURL().getString()); 46 writeUTF8String(fs->rootURL().getString());
47 return true; 47 return true;
48 } 48 }
49 if (wrapperTypeInfo == &V8RTCCertificate::wrapperTypeInfo) { 49 if (wrapperTypeInfo == &V8RTCCertificate::wrapperTypeInfo) {
50 RTCCertificate* certificate = wrappable->toImpl<RTCCertificate>(); 50 RTCCertificate* certificate = wrappable->toImpl<RTCCertificate>();
51 WebRTCCertificatePEM pem = certificate->certificate().toPEM(); 51 WebRTCCertificatePEM pem = certificate->certificate().toPEM();
52 writeTag(RTCCertificateTag); 52 writeTag(RTCCertificateTag);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 "A CryptoKey object could not be cloned."); 215 "A CryptoKey object could not be cloned.");
216 return false; 216 return false;
217 } 217 }
218 writeUint32(keyData.size()); 218 writeUint32(keyData.size());
219 writeRawBytes(keyData.data(), keyData.size()); 219 writeRawBytes(keyData.data(), keyData.size());
220 220
221 return true; 221 return true;
222 } 222 }
223 223
224 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698