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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/FileWriterBase.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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) 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 16 matching lines...) Expand all
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 "modules/filesystem/FileWriterBase.h" 31 #include "modules/filesystem/FileWriterBase.h"
32 32
33 #include "core/events/ProgressEvent.h" 33 #include "core/events/ProgressEvent.h"
34 #include "core/fileapi/Blob.h" 34 #include "core/fileapi/Blob.h"
35 #include "core/fileapi/FileError.h" 35 #include "core/fileapi/FileError.h"
36 #include "public/platform/WebFileWriter.h" 36 #include "public/platform/WebFileWriter.h"
37 #include <memory>
38 37
39 namespace blink { 38 namespace blink {
40 39
41 FileWriterBase::~FileWriterBase() 40 FileWriterBase::~FileWriterBase()
42 { 41 {
43 } 42 }
44 43
45 void FileWriterBase::initialize(std::unique_ptr<WebFileWriter> writer, long long length) 44 void FileWriterBase::initialize(PassOwnPtr<WebFileWriter> writer, long long leng th)
46 { 45 {
47 ASSERT(!m_writer); 46 ASSERT(!m_writer);
48 ASSERT(length >= 0); 47 ASSERT(length >= 0);
49 m_writer = std::move(writer); 48 m_writer = std::move(writer);
50 m_length = length; 49 m_length = length;
51 } 50 }
52 51
53 FileWriterBase::FileWriterBase() 52 FileWriterBase::FileWriterBase()
54 : m_position(0) 53 : m_position(0)
55 { 54 {
56 } 55 }
57 56
58 void FileWriterBase::seekInternal(long long position) 57 void FileWriterBase::seekInternal(long long position)
59 { 58 {
60 if (position > m_length) 59 if (position > m_length)
61 position = m_length; 60 position = m_length;
62 else if (position < 0) 61 else if (position < 0)
63 position = m_length + position; 62 position = m_length + position;
64 if (position < 0) 63 if (position < 0)
65 position = 0; 64 position = 0;
66 m_position = position; 65 m_position = position;
67 } 66 }
68 67
69 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698