OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 #include "bindings/v8/V8Binding.h" | 34 #include "bindings/v8/V8Binding.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class BlobBuilder; | 38 class BlobBuilder; |
39 | 39 |
40 // Shared code between the custom constructor bindings for Blob and File. | 40 // Shared code between the custom constructor bindings for Blob and File. |
41 namespace V8BlobCustomHelpers { | 41 namespace V8BlobCustomHelpers { |
42 | 42 |
43 // Extracts the "type" and "endings" properties out of the BlobPropertyBag passe d to a Blob constructor. | 43 // Parsed properties from a BlobPropertyBag or a FilePropertyBag. |
44 // http://www.w3.org/TR/FileAPI/#constructorParams | 44 // |
45 // Returns true if everything went well, false if a JS exception was thrown. | 45 // Instances are stack-allocated by the File and Blob constructor. |
46 bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobCl assName, String& contentType, String& endings, v8::Isolate*); | 46 // |
47 // processBlobPropertyBag is only called when constructors receive a value for | |
kinuko
2013/11/20 08:01:22
nit: comment looks stale
pwnall-personal
2013/11/20 09:51:07
It's still true.
lastModified is a bit of a snowf
kinuko
2013/11/20 10:13:39
I mean, we no longer seem to have the method proce
pwnall-personal
2013/11/20 10:40:31
Done.
Ah, that is a very good point! I updated the
| |
48 // the optional BlobPropertyBag / FilePropertyBag argument. The defaults set in | |
49 // the constructor are used otherwise. | |
50 class ParsedProperties { | |
51 public: | |
52 String contentType; | |
53 String endings; | |
kinuko
2013/11/20 08:01:22
I think we prefer having accessors for C++ class (
pwnall-personal
2013/11/20 09:51:07
Done.
Thank you!
| |
47 | 54 |
48 // Appends the blobParts passed to a Blob constructor into a BlobBuilder. | 55 // False if this contains the properties of a BlobPropertyBag. |
56 bool hasFileProperties; | |
57 | |
58 void setLastModified(double); | |
59 void setDefaultLastModified(); | |
60 double lastModified(); | |
61 | |
62 explicit ParsedProperties(bool hasFileProperties); | |
kinuko
2013/11/20 08:01:22
nit: usually we put ctor at the top
pwnall-personal
2013/11/20 09:51:07
Done.
Thank you for your patience in teaching me!
| |
63 | |
64 // Extracts the "type" and "endings" properties out of the BlobPropertyBag p assed to a Blob constructor. | |
65 // http://www.w3.org/TR/FileAPI/#constructorParams | |
66 // Returns true if everything went well, false if a JS exception was thrown. | |
67 bool parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blob ClassName, v8::Isolate*); | |
68 | |
69 private: | |
70 double m_lastModified; | |
71 #ifndef NDEBUG | |
72 bool m_hasLastModified; | |
73 #endif // NDEBUG | |
74 }; | |
75 | |
76 // Appends the blobParts passed to a Blob or File constructor into a BlobBuilder . | |
49 // http://www.w3.org/TR/FileAPI/#constructorParams | 77 // http://www.w3.org/TR/FileAPI/#constructorParams |
50 // Returns true if everything went well, false if a JS exception was thrown. | 78 // Returns true if everything went well, false if a JS exception was thrown. |
51 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength, const String& endings, BlobBuilder&, v8::Isolate*); | 79 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength, const String& endings, BlobBuilder&, v8::Isolate*); |
52 | 80 |
53 } // namespace V8BlobCustomHelpers | 81 } // namespace V8BlobCustomHelpers |
54 | 82 |
55 } // namespace WebCore | 83 } // namespace WebCore |
56 | 84 |
57 #endif // V8BlobCustomHelpers_h | 85 #endif // V8BlobCustomHelpers_h |
OLD | NEW |