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

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

Issue 563703002: Oilpan: Enable oilpan for callback classes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ASSERT(m_numberOfPendingCallbacks > 0); 106 ASSERT(m_numberOfPendingCallbacks > 0);
107 --m_numberOfPendingCallbacks; 107 --m_numberOfPendingCallbacks;
108 } 108 }
109 109
110 bool DOMFileSystem::hasPendingActivity() const 110 bool DOMFileSystem::hasPendingActivity() const
111 { 111 {
112 ASSERT(m_numberOfPendingCallbacks >= 0); 112 ASSERT(m_numberOfPendingCallbacks >= 0);
113 return m_numberOfPendingCallbacks; 113 return m_numberOfPendingCallbacks;
114 } 114 }
115 115
116 void DOMFileSystem::reportError(PassOwnPtrWillBeRawPtr<ErrorCallback> errorCallb ack, PassRefPtrWillBeRawPtr<FileError> fileError) 116 void DOMFileSystem::reportError(ErrorCallback* errorCallback, PassRefPtrWillBeRa wPtr<FileError> fileError)
117 { 117 {
118 scheduleCallback(errorCallback, fileError); 118 scheduleCallback(errorCallback, fileError);
119 } 119 }
120 120
121 namespace { 121 namespace {
122 122
123 class ConvertToFileWriterCallback : public FileWriterBaseCallback { 123 class ConvertToFileWriterCallback : public FileWriterBaseCallback {
124 public: 124 public:
125 static PassOwnPtrWillBeRawPtr<ConvertToFileWriterCallback> create(PassOwnPtr WillBeRawPtr<FileWriterCallback> callback) 125 static ConvertToFileWriterCallback* create(FileWriterCallback* callback)
126 { 126 {
127 return adoptPtrWillBeNoop(new ConvertToFileWriterCallback(callback)); 127 return new ConvertToFileWriterCallback(callback);
128 } 128 }
129 129
130 void trace(Visitor* visitor) 130 void trace(Visitor* visitor)
131 { 131 {
132 visitor->trace(m_callback); 132 visitor->trace(m_callback);
133 FileWriterBaseCallback::trace(visitor); 133 FileWriterBaseCallback::trace(visitor);
134 } 134 }
135 135
136 void handleEvent(FileWriterBase* fileWriterBase) 136 void handleEvent(FileWriterBase* fileWriterBase)
137 { 137 {
138 m_callback->handleEvent(static_cast<FileWriter*>(fileWriterBase)); 138 m_callback->handleEvent(static_cast<FileWriter*>(fileWriterBase));
139 } 139 }
140 private: 140 private:
141 explicit ConvertToFileWriterCallback(PassOwnPtrWillBeRawPtr<FileWriterCallba ck> callback) 141 explicit ConvertToFileWriterCallback(FileWriterCallback* callback)
142 : m_callback(callback) 142 : m_callback(callback)
143 { 143 {
144 } 144 }
145 OwnPtrWillBeMember<FileWriterCallback> m_callback; 145 Member<FileWriterCallback> m_callback;
146 }; 146 };
147 147
148 } 148 }
149 149
150 void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtrWillBeRaw Ptr<FileWriterCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> e rrorCallback) 150 void DOMFileSystem::createWriter(const FileEntry* fileEntry, FileWriterCallback* successCallback, ErrorCallback* errorCallback)
151 { 151 {
152 ASSERT(fileEntry); 152 ASSERT(fileEntry);
153 153
154 if (!fileSystem()) { 154 if (!fileSystem()) {
155 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); 155 reportError(errorCallback, FileError::create(FileError::ABORT_ERR));
156 return; 156 return;
157 } 157 }
158 158
159 FileWriter* fileWriter = FileWriter::create(executionContext()); 159 FileWriter* fileWriter = FileWriter::create(executionContext());
160 OwnPtrWillBeRawPtr<FileWriterBaseCallback> conversionCallback = ConvertToFil eWriterCallback::create(successCallback); 160 FileWriterBaseCallback* conversionCallback = ConvertToFileWriterCallback::cr eate(successCallback);
161 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create (fileWriter, conversionCallback.release(), errorCallback, m_context); 161 OwnPtr<AsyncFileSystemCallbacks> callbacks = FileWriterBaseCallbacks::create (fileWriter, conversionCallback, errorCallback, m_context);
162 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c allbacks.release()); 162 fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, c allbacks.release());
163 } 163 }
164 164
165 void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtrWillBeRawPt r<FileCallback> successCallback, PassOwnPtrWillBeRawPtr<ErrorCallback> errorCall back) 165 void DOMFileSystem::createFile(const FileEntry* fileEntry, FileCallback* success Callback, ErrorCallback* errorCallback)
166 { 166 {
167 KURL fileSystemURL = createFileSystemURL(fileEntry); 167 KURL fileSystemURL = createFileSystemURL(fileEntry);
168 if (!fileSystem()) { 168 if (!fileSystem()) {
169 reportError(errorCallback, FileError::create(FileError::ABORT_ERR)); 169 reportError(errorCallback, FileError::create(FileError::ABORT_ERR));
170 return; 170 return;
171 } 171 }
172 172
173 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa llback, m_context)); 173 fileSystem()->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileC allback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCa llback, m_context));
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698