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

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

Issue 1194093002: Remove unused FS callback partial specializations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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/FileSystemCallbacks.h ('k') | Source/modules/filesystem/FileWriter.h » ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 { 80 {
81 if (m_errorCallback) 81 if (m_errorCallback)
82 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea te(static_cast<FileError::ErrorCode>(code))); 82 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea te(static_cast<FileError::ErrorCode>(code)));
83 } 83 }
84 84
85 bool FileSystemCallbacksBase::shouldScheduleCallback() const 85 bool FileSystemCallbacksBase::shouldScheduleCallback() const
86 { 86 {
87 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon text->activeDOMObjectsAreSuspended(); 87 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon text->activeDOMObjectsAreSuspended();
88 } 88 }
89 89
90 #if !ENABLE(OILPAN)
91 template <typename CB, typename CBArg>
92 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback, RawPtr<CBArg> arg)
93 {
94 handleEventOrScheduleCallback(callback, arg.get());
95 }
96 #endif
97
98 template <typename CB, typename CBArg> 90 template <typename CB, typename CBArg>
99 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback, CBArg* arg) 91 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback, CBArg* arg)
100 { 92 {
101 ASSERT(callback); 93 ASSERT(callback);
102 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId) ; 94 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId) ;
103 if (shouldScheduleCallback()) 95 if (shouldScheduleCallback())
104 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get() , arg); 96 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get() , arg);
105 else if (callback) 97 else if (callback)
106 callback->handleEvent(arg); 98 callback->handleEvent(arg);
107 m_executionContext.clear(); 99 m_executionContext.clear();
108 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); 100 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
109 } 101 }
110 102
111 template <typename CB, typename CBArg>
112 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback, PassRefPtrWillBeRawPtr<CBArg> arg)
113 {
114 ASSERT(callback);
115 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId) ;
116 if (shouldScheduleCallback())
117 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get() , arg);
118 else if (callback)
119 callback->handleEvent(arg.get());
120 m_executionContext.clear();
121 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie);
122 }
123
124 template <typename CB> 103 template <typename CB>
125 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback) 104 void FileSystemCallbacksBase::handleEventOrScheduleCallback(RawPtr<CB> callback)
126 { 105 {
127 ASSERT(callback); 106 ASSERT(callback);
128 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId) ; 107 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync OperationCompletedCallbackStarting(m_executionContext.get(), m_asyncOperationId) ;
129 if (shouldScheduleCallback()) 108 if (shouldScheduleCallback())
130 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get() ); 109 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback.get() );
131 else if (callback) 110 else if (callback)
132 callback->handleEvent(); 111 callback->handleEvent();
133 m_executionContext.clear(); 112 m_executionContext.clear();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 240 }
262 241
263 void MetadataCallbacks::didReadMetadata(const FileMetadata& metadata) 242 void MetadataCallbacks::didReadMetadata(const FileMetadata& metadata)
264 { 243 {
265 if (m_successCallback) 244 if (m_successCallback)
266 handleEventOrScheduleCallback(m_successCallback.release(), Metadata::cre ate(metadata)); 245 handleEventOrScheduleCallback(m_successCallback.release(), Metadata::cre ate(metadata));
267 } 246 }
268 247
269 // FileWriterBaseCallbacks ---------------------------------------------------- 248 // FileWriterBaseCallbacks ----------------------------------------------------
270 249
271 PassOwnPtr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(PassRefPtrW illBeRawPtr<FileWriterBase> fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionContext* context) 250 PassOwnPtr<AsyncFileSystemCallbacks> FileWriterBaseCallbacks::create(FileWriterB ase* fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* errorCa llback, ExecutionContext* context)
272 { 251 {
273 return adoptPtr(new FileWriterBaseCallbacks(fileWriter, successCallback, err orCallback, context)); 252 return adoptPtr(new FileWriterBaseCallbacks(fileWriter, successCallback, err orCallback, context));
274 } 253 }
275 254
276 FileWriterBaseCallbacks::FileWriterBaseCallbacks(PassRefPtrWillBeRawPtr<FileWrit erBase> fileWriter, FileWriterBaseCallback* successCallback, ErrorCallback* erro rCallback, ExecutionContext* context) 255 FileWriterBaseCallbacks::FileWriterBaseCallbacks(FileWriterBase* fileWriter, Fil eWriterBaseCallback* successCallback, ErrorCallback* errorCallback, ExecutionCon text* context)
277 : FileSystemCallbacksBase(errorCallback, nullptr, context) 256 : FileSystemCallbacksBase(errorCallback, nullptr, context)
278 , m_fileWriter(fileWriter.get()) 257 , m_fileWriter(fileWriter)
279 , m_successCallback(successCallback) 258 , m_successCallback(successCallback)
280 { 259 {
281 } 260 }
282 261
283 void FileWriterBaseCallbacks::didCreateFileWriter(PassOwnPtr<WebFileWriter> file Writer, long long length) 262 void FileWriterBaseCallbacks::didCreateFileWriter(PassOwnPtr<WebFileWriter> file Writer, long long length)
284 { 263 {
285 m_fileWriter->initialize(fileWriter, length); 264 m_fileWriter->initialize(fileWriter, length);
286 if (m_successCallback) 265 if (m_successCallback)
287 handleEventOrScheduleCallback(m_successCallback.release(), m_fileWriter. release()); 266 handleEventOrScheduleCallback(m_successCallback.release(), m_fileWriter. release().get());
288 } 267 }
289 268
290 // SnapshotFileCallback ------------------------------------------------------- 269 // SnapshotFileCallback -------------------------------------------------------
291 270
292 PassOwnPtr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemB ase* filesystem, const String& name, const KURL& url, FileCallback* successCallb ack, ErrorCallback* errorCallback, ExecutionContext* context) 271 PassOwnPtr<AsyncFileSystemCallbacks> SnapshotFileCallback::create(DOMFileSystemB ase* filesystem, const String& name, const KURL& url, FileCallback* successCallb ack, ErrorCallback* errorCallback, ExecutionContext* context)
293 { 272 {
294 return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallb ack, errorCallback, context)); 273 return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallb ack, errorCallback, context));
295 } 274 }
296 275
297 SnapshotFileCallback::SnapshotFileCallback(DOMFileSystemBase* filesystem, const String& name, const KURL& url, FileCallback* successCallback, ErrorCallback* err orCallback, ExecutionContext* context) 276 SnapshotFileCallback::SnapshotFileCallback(DOMFileSystemBase* filesystem, const String& name, const KURL& url, FileCallback* successCallback, ErrorCallback* err orCallback, ExecutionContext* context)
(...skipping 30 matching lines...) Expand all
328 { 307 {
329 } 308 }
330 309
331 void VoidCallbacks::didSucceed() 310 void VoidCallbacks::didSucceed()
332 { 311 {
333 if (m_successCallback) 312 if (m_successCallback)
334 handleEventOrScheduleCallback(m_successCallback.release()); 313 handleEventOrScheduleCallback(m_successCallback.release());
335 } 314 }
336 315
337 } // namespace blink 316 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/filesystem/FileSystemCallbacks.h ('k') | Source/modules/filesystem/FileWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698