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

Side by Side Diff: Source/bindings/v8/custom/V8BlobCustomHelpers.h

Issue 80983002: File constructor understands lastModified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added isolate to v8::Date::New to avoid deprecation warning. Created 7 years 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 /* 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
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 // parseBlobPropertyBag 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 const String& contentType() const { return m_contentType; }
55 const String& endings() const { return m_endings; }
56 void setLastModified(double);
57 void setDefaultLastModified();
58 double lastModified() const
59 {
60 ASSERT(m_hasFileProperties);
61 ASSERT(m_hasLastModified);
62 return m_lastModified;
63 }
64
65 // Extracts the "type" and "endings" properties out of the BlobPropertyBag p assed to a Blob constructor.
66 // http://www.w3.org/TR/FileAPI/#constructorParams
67 // Returns true if everything went well, false if a JS exception was thrown.
68 bool parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blob ClassName, v8::Isolate*);
69
70 private:
71 String m_contentType;
72 String m_endings;
73
74 // False if this contains the properties of a BlobPropertyBag.
75 bool m_hasFileProperties;
76
77 double m_lastModified;
78 #ifndef NDEBUG
79 bool m_hasLastModified;
80 #endif // NDEBUG
81 };
82
83 // Appends the blobParts passed to a Blob or File constructor into a BlobBuilder .
49 // http://www.w3.org/TR/FileAPI/#constructorParams 84 // http://www.w3.org/TR/FileAPI/#constructorParams
50 // Returns true if everything went well, false if a JS exception was thrown. 85 // 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*); 86 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength, const String& endings, BlobBuilder&, v8::Isolate*);
52 87
53 } // namespace V8BlobCustomHelpers 88 } // namespace V8BlobCustomHelpers
54 89
55 } // namespace WebCore 90 } // namespace WebCore
56 91
57 #endif // V8BlobCustomHelpers_h 92 #endif // V8BlobCustomHelpers_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8BlobCustom.cpp ('k') | Source/bindings/v8/custom/V8BlobCustomHelpers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698