| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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/ExceptionState.h" | 34 #include "bindings/v8/ExceptionState.h" |
| 35 #include "bindings/v8/custom/V8BlobCustomHelpers.h" | 35 #include "bindings/v8/custom/V8BlobCustomHelpers.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 void V8Blob::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 39 void V8Blob::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 40 { | 40 { |
| 41 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Blob", i
nfo.Holder(), info.GetIsolate()); | 41 ExceptionState exceptionState(ExceptionState::ConstructionContext, "Blob", i
nfo.Holder(), info.GetIsolate()); |
| 42 if (!info.Length()) { | 42 if (!info.Length()) { |
| 43 RefPtr<Blob> blob = Blob::create(); | 43 RefPtrWillBeRawPtr<Blob> blob = Blob::create(); |
| 44 v8SetReturnValue(info, blob.release()); | 44 v8SetReturnValue(info, blob.release()); |
| 45 return; | 45 return; |
| 46 } | 46 } |
| 47 | 47 |
| 48 uint32_t length = 0; | 48 uint32_t length = 0; |
| 49 if (info[0]->IsArray()) { | 49 if (info[0]->IsArray()) { |
| 50 length = v8::Local<v8::Array>::Cast(info[0])->Length(); | 50 length = v8::Local<v8::Array>::Cast(info[0])->Length(); |
| 51 } else { | 51 } else { |
| 52 const int sequenceArgumentIndex = 0; | 52 const int sequenceArgumentIndex = 0; |
| 53 if (toV8Sequence(info[sequenceArgumentIndex], length, info.GetIsolate())
.IsEmpty()) { | 53 if (toV8Sequence(info[sequenceArgumentIndex], length, info.GetIsolate())
.IsEmpty()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 OwnPtr<BlobData> blobData = BlobData::create(); | 74 OwnPtr<BlobData> blobData = BlobData::create(); |
| 75 blobData->setContentType(properties.contentType()); | 75 blobData->setContentType(properties.contentType()); |
| 76 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); | 76 v8::Local<v8::Object> blobParts = v8::Local<v8::Object>::Cast(info[0]); |
| 77 if (!V8BlobCustomHelpers::processBlobParts(blobParts, length, properties.nor
malizeLineEndingsToNative(), *blobData, info.GetIsolate())) | 77 if (!V8BlobCustomHelpers::processBlobParts(blobParts, length, properties.nor
malizeLineEndingsToNative(), *blobData, info.GetIsolate())) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 long long blobSize = blobData->length(); | 80 long long blobSize = blobData->length(); |
| 81 RefPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData.release(),
blobSize)); | 81 RefPtrWillBeRawPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData
.release(), blobSize)); |
| 82 v8SetReturnValue(info, blob.release()); | 82 v8SetReturnValue(info, blob.release()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace WebCore | 85 } // namespace WebCore |
| OLD | NEW |