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 | |
48 // the optional BlobPropertyBag / FilePropertyBag argument. The defaults set in | |
49 // the constructor are used otherwise. | |
50 class ParsedProperties { | |
51 public: | |
52 explicit ParsedProperties(bool hasFileProperties); | |
47 | 53 |
48 // Appends the blobParts passed to a Blob constructor into a BlobBuilder. | 54 inline const String& contentType() { return m_contentType; } |
55 inline const String& endings() { return m_endings; } | |
kinuko
2013/11/20 10:13:40
nit: no need of 'inline'
Could these method be co
pwnall-personal
2013/11/20 10:40:31
Done.
Thank you!
| |
56 void setLastModified(double); | |
57 void setDefaultLastModified(); | |
58 double lastModified(); | |
59 | |
60 // Extracts the "type" and "endings" properties out of the BlobPropertyBag p assed to a Blob constructor. | |
61 // http://www.w3.org/TR/FileAPI/#constructorParams | |
62 // Returns true if everything went well, false if a JS exception was thrown. | |
63 bool parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blob ClassName, v8::Isolate*); | |
64 | |
65 private: | |
66 String m_contentType; | |
67 String m_endings; | |
68 | |
69 // False if this contains the properties of a BlobPropertyBag. | |
70 bool m_hasFileProperties; | |
71 | |
72 double m_lastModified; | |
73 #ifndef NDEBUG | |
74 bool m_hasLastModified; | |
75 #endif // NDEBUG | |
76 }; | |
77 | |
78 // Appends the blobParts passed to a Blob or File constructor into a BlobBuilder . | |
49 // http://www.w3.org/TR/FileAPI/#constructorParams | 79 // http://www.w3.org/TR/FileAPI/#constructorParams |
50 // Returns true if everything went well, false if a JS exception was thrown. | 80 // 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*); | 81 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength, const String& endings, BlobBuilder&, v8::Isolate*); |
52 | 82 |
53 } // namespace V8BlobCustomHelpers | 83 } // namespace V8BlobCustomHelpers |
54 | 84 |
55 } // namespace WebCore | 85 } // namespace WebCore |
56 | 86 |
57 #endif // V8BlobCustomHelpers_h | 87 #endif // V8BlobCustomHelpers_h |
OLD | NEW |