| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #if ENABLE(ASSERT) | 61 #if ENABLE(ASSERT) |
| 62 m_hasLastModified = true; | 62 m_hasLastModified = true; |
| 63 #endif // ENABLE(ASSERT) | 63 #endif // ENABLE(ASSERT) |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ParsedProperties::setDefaultLastModified() | 66 void ParsedProperties::setDefaultLastModified() |
| 67 { | 67 { |
| 68 setLastModified(currentTime()); | 68 setLastModified(currentTime()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool ParsedProperties::parseBlobPropertyBag(v8::Local<v8::Value> propertyBag, co
nst char* blobClassName, ExceptionState& exceptionState, v8::Isolate* isolate) | 71 bool ParsedProperties::parseBlobPropertyBag(v8::Isolate* isolate, v8::Local<v8::
Value> propertyBag, const char* blobClassName, ExceptionState& exceptionState) |
| 72 { | 72 { |
| 73 TONATIVE_DEFAULT(Dictionary, dictionary, Dictionary(propertyBag, isolate), f
alse); | 73 TONATIVE_DEFAULT(Dictionary, dictionary, Dictionary(propertyBag, isolate), f
alse); |
| 74 | 74 |
| 75 String endings; | 75 String endings; |
| 76 TONATIVE_DEFAULT(bool, containsEndings, DictionaryHelper::get(dictionary, "e
ndings", endings), false); | 76 TONATIVE_DEFAULT(bool, containsEndings, DictionaryHelper::get(dictionary, "e
ndings", endings), false); |
| 77 if (containsEndings) { | 77 if (containsEndings) { |
| 78 if (endings != "transparent" && endings != "native") { | 78 if (endings != "transparent" && endings != "native") { |
| 79 exceptionState.throwTypeError("The 'endings' property must be either
'transparent' or 'native'."); | 79 exceptionState.throwTypeError("The 'endings' property must be either
'transparent' or 'native'."); |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 100 if (containsLastModified) { | 100 if (containsLastModified) { |
| 101 TONATIVE_DEFAULT(long long, lastModifiedInt, toInt64(lastModified), fals
e); | 101 TONATIVE_DEFAULT(long long, lastModifiedInt, toInt64(lastModified), fals
e); |
| 102 setLastModified(static_cast<double>(lastModifiedInt) / msPerSecond); | 102 setLastModified(static_cast<double>(lastModifiedInt) / msPerSecond); |
| 103 } else { | 103 } else { |
| 104 setDefaultLastModified(); | 104 setDefaultLastModified(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool processBlobParts(v8::Local<v8::Object> blobParts, bool normalizeLineEndings
ToNative, BlobData& blobData, v8::Isolate* isolate) | 110 bool processBlobParts(v8::Isolate* isolate, v8::Local<v8::Object> blobParts, boo
l normalizeLineEndingsToNative, BlobData& blobData) |
| 111 { | 111 { |
| 112 // FIXME: handle sequences based on ES6 @@iterator, see http://crbug.com/393
866 | 112 // FIXME: handle sequences based on ES6 @@iterator, see http://crbug.com/393
866 |
| 113 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(blobParts); | 113 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(blobParts); |
| 114 uint32_t length = v8::Local<v8::Array>::Cast(blobParts)->Length(); | 114 uint32_t length = v8::Local<v8::Array>::Cast(blobParts)->Length(); |
| 115 for (uint32_t i = 0; i < length; ++i) { | 115 for (uint32_t i = 0; i < length; ++i) { |
| 116 v8::Local<v8::Value> item = array->Get(i); | 116 v8::Local<v8::Value> item = array->Get(i); |
| 117 if (item.IsEmpty()) | 117 if (item.IsEmpty()) |
| 118 return false; | 118 return false; |
| 119 | 119 |
| 120 if (V8ArrayBuffer::hasInstance(item, isolate)) { | 120 if (V8ArrayBuffer::hasInstance(item, isolate)) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); | 133 TOSTRING_DEFAULT(V8StringResource<>, stringValue, item, false); |
| 134 blobData.appendText(stringValue, normalizeLineEndingsToNative); | 134 blobData.appendText(stringValue, normalizeLineEndingsToNative); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace V8BlobCustomHelpers | 140 } // namespace V8BlobCustomHelpers |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |