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

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

Issue 314333002: Enable Oilpan by default in modules/filesystem/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove consts from conversion ctor + copy assignment op Created 6 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
« no previous file with comments | « Source/modules/filesystem/DOMFileSystem.h ('k') | Source/modules/filesystem/DOMFileSystem.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "platform/weborigin/SecurityOrigin.h" 47 #include "platform/weborigin/SecurityOrigin.h"
48 #include "public/platform/WebFileSystem.h" 48 #include "public/platform/WebFileSystem.h"
49 #include "public/platform/WebFileSystemCallbacks.h" 49 #include "public/platform/WebFileSystemCallbacks.h"
50 #include "wtf/OwnPtr.h" 50 #include "wtf/OwnPtr.h"
51 #include "wtf/text/StringBuilder.h" 51 #include "wtf/text/StringBuilder.h"
52 #include "wtf/text/WTFString.h" 52 #include "wtf/text/WTFString.h"
53 53
54 namespace WebCore { 54 namespace WebCore {
55 55
56 // static 56 // static
57 PassRefPtrWillBeRawPtr<DOMFileSystem> DOMFileSystem::create(ExecutionContext* co ntext, const String& name, FileSystemType type, const KURL& rootURL) 57 DOMFileSystem* DOMFileSystem::create(ExecutionContext* context, const String& na me, FileSystemType type, const KURL& rootURL)
58 { 58 {
59 RefPtrWillBeRawPtr<DOMFileSystem> fileSystem(adoptRefWillBeRefCountedGarbage Collected(new DOMFileSystem(context, name, type, rootURL))); 59 DOMFileSystem* fileSystem(new DOMFileSystem(context, name, type, rootURL));
60 fileSystem->suspendIfNeeded(); 60 fileSystem->suspendIfNeeded();
61 return fileSystem.release(); 61 return fileSystem;
62 } 62 }
63 63
64 PassRefPtrWillBeRawPtr<DOMFileSystem> DOMFileSystem::createIsolatedFileSystem(Ex ecutionContext* context, const String& filesystemId) 64 DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(ExecutionContext* context , const String& filesystemId)
65 { 65 {
66 if (filesystemId.isEmpty()) 66 if (filesystemId.isEmpty())
67 return nullptr; 67 return 0;
68 68
69 StringBuilder filesystemName; 69 StringBuilder filesystemName;
70 filesystemName.append(createDatabaseIdentifierFromSecurityOrigin(context->se curityOrigin())); 70 filesystemName.append(createDatabaseIdentifierFromSecurityOrigin(context->se curityOrigin()));
71 filesystemName.append(":Isolated_"); 71 filesystemName.append(":Isolated_");
72 filesystemName.append(filesystemId); 72 filesystemName.append(filesystemId);
73 73
74 // The rootURL created here is going to be attached to each filesystem reque st and 74 // The rootURL created here is going to be attached to each filesystem reque st and
75 // is to be validated each time the request is being handled. 75 // is to be validated each time the request is being handled.
76 StringBuilder rootURL; 76 StringBuilder rootURL;
77 rootURL.append("filesystem:"); 77 rootURL.append("filesystem:");
78 rootURL.append(context->securityOrigin()->toString()); 78 rootURL.append(context->securityOrigin()->toString());
79 rootURL.append("/"); 79 rootURL.append("/");
80 rootURL.append(isolatedPathPrefix); 80 rootURL.append(isolatedPathPrefix);
81 rootURL.append("/"); 81 rootURL.append("/");
82 rootURL.append(filesystemId); 82 rootURL.append(filesystemId);
83 rootURL.append("/"); 83 rootURL.append("/");
84 84
85 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT ypeIsolated, KURL(ParsedURLString, rootURL.toString())); 85 return DOMFileSystem::create(context, filesystemName.toString(), FileSystemT ypeIsolated, KURL(ParsedURLString, rootURL.toString()));
86 } 86 }
87 87
88 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File SystemType type, const KURL& rootURL) 88 DOMFileSystem::DOMFileSystem(ExecutionContext* context, const String& name, File SystemType type, const KURL& rootURL)
89 : DOMFileSystemBase(context, name, type, rootURL) 89 : DOMFileSystemBase(context, name, type, rootURL)
90 , ActiveDOMObject(context) 90 , ActiveDOMObject(context)
91 , m_numberOfPendingCallbacks(0) 91 , m_numberOfPendingCallbacks(0)
92 { 92 {
93 ScriptWrappable::init(this); 93 ScriptWrappable::init(this);
94 } 94 }
95 95
96 PassRefPtrWillBeRawPtr<DirectoryEntry> DOMFileSystem::root() 96 DirectoryEntry* DOMFileSystem::root()
97 { 97 {
98 return DirectoryEntry::create(this, DOMFilePath::root); 98 return DirectoryEntry::create(this, DOMFilePath::root);
99 } 99 }
100 100
101 void DOMFileSystem::addPendingCallbacks() 101 void DOMFileSystem::addPendingCallbacks()
102 { 102 {
103 ++m_numberOfPendingCallbacks; 103 ++m_numberOfPendingCallbacks;
104 } 104 }
105 105
106 void DOMFileSystem::removePendingCallbacks() 106 void DOMFileSystem::removePendingCallbacks()
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 OwnPtr<FileWriterCallback> m_callback; 141 OwnPtr<FileWriterCallback> m_callback;
142 }; 142 };
143 143
144 } 144 }
145 145
146 void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtr<FileWrit erCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback) 146 void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtr<FileWrit erCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback)
147 { 147 {
148 ASSERT(fileEntry); 148 ASSERT(fileEntry);
149 149
150 RefPtrWillBeRawPtr<FileWriter> fileWriter = FileWriter::create(executionCont ext()); 150 FileWriter* fileWriter = FileWriter::create(executionContext());
151 OwnPtr<FileWriterBaseCallback> conversionCallback = ConvertToFileWriterCallb ack::create(successCallback); 151 OwnPtr<FileWriterBaseCallback> conversionCallback = ConvertToFileWriterCallb ack::create(successCallback);
152 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create (fileWriter, conversionCallback.release(), errorCallback, m_context); 152 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create (fileWriter, conversionCallback.release(), errorCallback, m_context);
153 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter.ge t(), callbacks.release()); 153 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c allbacks.release());
154 } 154 }
155 155
156 namespace { 156 namespace {
157 157
158 class SnapshotFileCallback : public FileSystemCallbacksBase { 158 class SnapshotFileCallback : public FileSystemCallbacksBase {
159 public: 159 public:
160 static PassOwnPtr<AsyncFileSystemCallbacks> create(PassRefPtrWillBeRawPtr<DO MFileSystem> filesystem, const String& name, const KURL& url, PassOwnPtr<FileCal lback> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContex t* context) 160 static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystem* filesystem , const String& name, const KURL& url, PassOwnPtr<FileCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContext* context)
161 { 161 {
162 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new SnapshotFileC allback(filesystem, name, url, successCallback, errorCallback, context))); 162 return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new SnapshotFileC allback(filesystem, name, url, successCallback, errorCallback, context)));
163 } 163 }
164 164
165 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr< BlobDataHandle> snapshot) 165 virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr< BlobDataHandle> snapshot)
166 { 166 {
167 if (!m_successCallback) 167 if (!m_successCallback)
168 return; 168 return;
169 169
170 // We can't directly use the snapshot blob data handle because the conte nt type on it hasn't been set. 170 // We can't directly use the snapshot blob data handle because the conte nt type on it hasn't been set.
(...skipping 12 matching lines...) Expand all
183 m_successCallback->handleEvent(File::createForFileSystemFile(m_name, metadata).get()); 183 m_successCallback->handleEvent(File::createForFileSystemFile(m_name, metadata).get());
184 } else { 184 } else {
185 // Otherwise create a File from the FileSystem URL. 185 // Otherwise create a File from the FileSystem URL.
186 m_successCallback->handleEvent(File::createForFileSystemFile(m_url, metadata).get()); 186 m_successCallback->handleEvent(File::createForFileSystemFile(m_url, metadata).get());
187 } 187 }
188 188
189 m_successCallback.release(); 189 m_successCallback.release();
190 } 190 }
191 191
192 private: 192 private:
193 SnapshotFileCallback(PassRefPtrWillBeRawPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassOwnPtr<FileCallback> successCallback, PassOw nPtr<ErrorCallback> errorCallback, ExecutionContext* context) 193 SnapshotFileCallback(DOMFileSystem* filesystem, const String& name, const KU RL& url, PassOwnPtr<FileCallback> successCallback, PassOwnPtr<ErrorCallback> err orCallback, ExecutionContext* context)
194 : FileSystemCallbacksBase(errorCallback, filesystem.get(), context) 194 : FileSystemCallbacksBase(errorCallback, filesystem, context)
195 , m_name(name) 195 , m_name(name)
196 , m_url(url) 196 , m_url(url)
197 , m_successCallback(successCallback) 197 , m_successCallback(successCallback)
198 { 198 {
199 } 199 }
200 200
201 String m_name; 201 String m_name;
202 KURL m_url; 202 KURL m_url;
203 OwnPtr<FileCallback> m_successCallback; 203 OwnPtr<FileCallback> m_successCallback;
204 }; 204 };
205 205
206 } // namespace 206 } // namespace
207 207
208 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback) 208 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallba ck> successCallback, PassOwnPtr<ErrorCallback> errorCallback)
209 { 209 {
210 KURL fileSystemURL = createFileSystemURL(fileEntry); 210 KURL fileSystemURL = createFileSystemURL(fileEntry);
211 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa llback, m_context)); 211 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa llback, m_context));
212 } 212 }
213 213
214 } // namespace WebCore 214 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/filesystem/DOMFileSystem.h ('k') | Source/modules/filesystem/DOMFileSystem.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698