Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Samsung Electronics. 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 |
| 11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "modules/filesystem/FileWriterBase.h" | 33 #include "V8SVGNumber.h" |
| 34 | |
| 35 #include "core/dom/ExceptionCode.h" | |
| 36 #include "core/dom/ProgressEvent.h" | |
| 37 #include "core/fileapi/Blob.h" | |
| 38 #include "core/fileapi/FileError.h" | |
| 39 #include "modules/filesystem/AsyncFileWriter.h" | |
| 40 | 34 |
| 41 namespace WebCore { | 35 namespace WebCore { |
| 42 | 36 |
| 43 FileWriterBase::~FileWriterBase() | 37 void V8SVGNumber::valueAttrGetterCustom(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) |
|
haraken
2013/07/15 10:59:15
I guess this getter doesn't need to be custom. You
do-not-use
2013/07/15 11:11:14
This does not work. SVGNumber is a typedef to floa
| |
| 44 { | 38 { |
| 39 SVGPropertyTearOff<SVGNumber>* wrapper = V8SVGNumber::toNative(info.Holder() ); | |
| 40 SVGNumber& impl = wrapper->propertyReference(); | |
| 41 v8SetReturnValue(info, impl); | |
| 45 } | 42 } |
| 46 | 43 |
| 47 void FileWriterBase::initialize(PassOwnPtr<AsyncFileWriter> writer, long long le ngth) | 44 void V8SVGNumber::valueAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8 ::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| 48 { | 45 { |
| 49 ASSERT(!m_writer); | 46 SVGPropertyTearOff<SVGNumber>* wrapper = V8SVGNumber::toNative(info.Holder() ); |
| 50 ASSERT(length >= 0); | 47 if (wrapper->isReadOnly()) { |
| 51 m_writer = writer; | 48 setDOMException(NoModificationAllowedError, info.GetIsolate()); |
| 52 m_length = length; | 49 return; |
| 53 } | 50 } |
| 54 | 51 SVGNumber& impl = wrapper->propertyReference(); |
| 55 FileWriterBase::FileWriterBase() | 52 V8TRYCATCH_VOID(SVGNumber, v, static_cast<float>(value->NumberValue())); |
| 56 : m_position(0) | 53 impl = v; |
| 57 { | 54 wrapper->commitChange(); |
|
haraken
2013/07/15 10:59:15
Would it be possible to get rid of the custom sett
| |
| 58 } | |
| 59 | |
| 60 void FileWriterBase::seekInternal(long long position) | |
| 61 { | |
| 62 if (position > m_length) | |
| 63 position = m_length; | |
| 64 else if (position < 0) | |
| 65 position = m_length + position; | |
| 66 if (position < 0) | |
| 67 position = 0; | |
| 68 m_position = position; | |
| 69 } | 55 } |
| 70 | 56 |
| 71 } // namespace WebCore | 57 } // namespace WebCore |
| OLD | NEW |