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

Side by Side Diff: Source/modules/filesystem/DOMFileSystemSync.cpp

Issue 176853004: Oilpan: move core/fileapi to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 9 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 DOMFileSystemSync::DOMFileSystemSync(ExecutionContext* context, const String& na me, FileSystemType type, const KURL& rootURL) 58 DOMFileSystemSync::DOMFileSystemSync(ExecutionContext* context, const String& na me, FileSystemType type, const KURL& rootURL)
59 : DOMFileSystemBase(context, name, type, rootURL) 59 : DOMFileSystemBase(context, name, type, rootURL)
60 { 60 {
61 ScriptWrappable::init(this); 61 ScriptWrappable::init(this);
62 } 62 }
63 63
64 DOMFileSystemSync::~DOMFileSystemSync() 64 DOMFileSystemSync::~DOMFileSystemSync()
65 { 65 {
66 } 66 }
67 67
68 void DOMFileSystemSync::reportError(PassOwnPtr<ErrorCallback> errorCallback, Pas sRefPtr<FileError> fileError) 68 void DOMFileSystemSync::reportError(PassOwnPtr<ErrorCallback> errorCallback, Pas sRefPtrWillBeRawPtr<FileError> fileError)
69 { 69 {
70 errorCallback->handleEvent(fileError.get()); 70 errorCallback->handleEvent(fileError.get());
71 } 71 }
72 72
73 PassRefPtr<DirectoryEntrySync> DOMFileSystemSync::root() 73 PassRefPtr<DirectoryEntrySync> DOMFileSystemSync::root()
74 { 74 {
75 return DirectoryEntrySync::create(this, DOMFilePath::root); 75 return DirectoryEntrySync::create(this, DOMFilePath::root);
76 } 76 }
77 77
78 namespace { 78 namespace {
79 79
80 class CreateFileHelper FINAL : public AsyncFileSystemCallbacks { 80 class CreateFileHelper FINAL : public AsyncFileSystemCallbacks {
81 public: 81 public:
82 class CreateFileResult : public RefCounted<CreateFileResult> { 82 class CreateFileResult : public RefCounted<CreateFileResult> {
83 public: 83 public:
84 static PassRefPtr<CreateFileResult> create() 84 static PassRefPtr<CreateFileResult> create()
85 { 85 {
86 return adoptRef(new CreateFileResult()); 86 return adoptRef(new CreateFileResult());
87 } 87 }
88 88
89 bool m_failed; 89 bool m_failed;
90 int m_code; 90 int m_code;
91 RefPtr<File> m_file; 91 RefPtrWillBePersistent<File> m_file;
92 92
93 private: 93 private:
94 CreateFileResult() 94 CreateFileResult()
95 : m_failed(false) 95 : m_failed(false)
96 , m_code(0) 96 , m_code(0)
97 { 97 {
98 } 98 }
99 99
100 ~CreateFileResult() 100 ~CreateFileResult()
101 { 101 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 RefPtr<CreateFileResult> m_result; 158 RefPtr<CreateFileResult> m_result;
159 String m_name; 159 String m_name;
160 KURL m_url; 160 KURL m_url;
161 FileSystemType m_type; 161 FileSystemType m_type;
162 }; 162 };
163 163
164 } // namespace 164 } // namespace
165 165
166 PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, E xceptionState& exceptionState) 166 PassRefPtrWillBeRawPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, ExceptionState& exceptionState)
167 { 167 {
168 KURL fileSystemURL = createFileSystemURL(fileEntry); 168 KURL fileSystemURL = createFileSystemURL(fileEntry);
169 RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFi leResult::create()); 169 RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFi leResult::create());
170 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, CreateFileHel per::create(result, fileEntry->name(), fileSystemURL, type())); 170 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, CreateFileHel per::create(result, fileEntry->name(), fileSystemURL, type()));
171 if (result->m_failed) { 171 if (result->m_failed) {
172 exceptionState.throwDOMException(result->m_code, "Could not create '" + fileEntry->name() + "'."); 172 exceptionState.throwDOMException(result->m_code, "Could not create '" + fileEntry->name() + "'.");
173 return nullptr; 173 return nullptr;
174 } 174 }
175 return result->m_file; 175 return result->m_file.get();
176 } 176 }
177 177
178 namespace { 178 namespace {
179 179
180 class ReceiveFileWriterCallback FINAL : public FileWriterBaseCallback { 180 class ReceiveFileWriterCallback FINAL : public FileWriterBaseCallback {
181 public: 181 public:
182 static PassOwnPtr<ReceiveFileWriterCallback> create() 182 static PassOwnPtr<ReceiveFileWriterCallback> create()
183 { 183 {
184 return adoptPtr(new ReceiveFileWriterCallback()); 184 return adoptPtr(new ReceiveFileWriterCallback());
185 } 185 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter.ge t(), callbacks.release()); 233 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter.ge t(), callbacks.release());
234 if (errorCode != FileError::OK) { 234 if (errorCode != FileError::OK) {
235 FileError::throwDOMException(exceptionState, errorCode); 235 FileError::throwDOMException(exceptionState, errorCode);
236 return nullptr; 236 return nullptr;
237 } 237 }
238 return fileWriter.release(); 238 return fileWriter.release();
239 } 239 }
240 240
241 } 241 }
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMFileSystemSync.h ('k') | Source/modules/filesystem/FileEntrySync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698