| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/fileapi/Blob.h" | 36 #include "core/fileapi/Blob.h" |
| 37 #include "core/fileapi/FileError.h" | 37 #include "core/fileapi/FileError.h" |
| 38 #include "public/platform/WebFileWriter.h" | 38 #include "public/platform/WebFileWriter.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 FileWriterBase::~FileWriterBase() | 42 FileWriterBase::~FileWriterBase() |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 void FileWriterBase::initialize(PassOwnPtr<blink::WebFileWriter> writer, long lo
ng length) | 46 void FileWriterBase::initialize(PassOwnPtr<WebFileWriter> writer, long long leng
th) |
| 47 { | 47 { |
| 48 ASSERT(!m_writer); | 48 ASSERT(!m_writer); |
| 49 ASSERT(length >= 0); | 49 ASSERT(length >= 0); |
| 50 m_writer = writer; | 50 m_writer = writer; |
| 51 m_length = length; | 51 m_length = length; |
| 52 } | 52 } |
| 53 | 53 |
| 54 FileWriterBase::FileWriterBase() | 54 FileWriterBase::FileWriterBase() |
| 55 : m_position(0) | 55 : m_position(0) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 void FileWriterBase::seekInternal(long long position) | 59 void FileWriterBase::seekInternal(long long position) |
| 60 { | 60 { |
| 61 if (position > m_length) | 61 if (position > m_length) |
| 62 position = m_length; | 62 position = m_length; |
| 63 else if (position < 0) | 63 else if (position < 0) |
| 64 position = m_length + position; | 64 position = m_length + position; |
| 65 if (position < 0) | 65 if (position < 0) |
| 66 position = 0; | 66 position = 0; |
| 67 m_position = position; | 67 m_position = position; |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |