| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 FileSystemCallbacksBase::~FileSystemCallbacksBase() | 66 FileSystemCallbacksBase::~FileSystemCallbacksBase() |
| 67 { | 67 { |
| 68 if (m_fileSystem) | 68 if (m_fileSystem) |
| 69 m_fileSystem->removePendingCallbacks(); | 69 m_fileSystem->removePendingCallbacks(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void FileSystemCallbacksBase::didFail(int code) | 72 void FileSystemCallbacksBase::didFail(int code) |
| 73 { | 73 { |
| 74 if (m_errorCallback) | 74 if (m_errorCallback) |
| 75 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea
te(static_cast<FileError::ErrorCode>(code))); | 75 handleEventOrScheduleCallback(m_errorCallback.release(), static_cast<Fil
eError::ErrorCode>(code)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool FileSystemCallbacksBase::shouldScheduleCallback() const | 78 bool FileSystemCallbacksBase::shouldScheduleCallback() const |
| 79 { | 79 { |
| 80 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon
text->activeDOMObjectsAreSuspended(); | 80 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon
text->activeDOMObjectsAreSuspended(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 template <typename CB, typename CBArg> | 83 template <typename CB, typename CBArg> |
| 84 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg*
arg) | 84 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg
arg) |
| 85 { | 85 { |
| 86 ASSERT(callback); | 86 ASSERT(callback); |
| 87 if (shouldScheduleCallback()) | 87 if (shouldScheduleCallback()) |
| 88 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback, arg)
; | 88 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback, arg)
; |
| 89 else if (callback) | 89 else if (callback) |
| 90 callback->handleEvent(arg); | 90 callback->handleEvent(arg); |
| 91 m_executionContext.clear(); | 91 m_executionContext.clear(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 template <typename CB> | 94 template <typename CB> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 { | 194 { |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL,
FileSystemType type, const String& filePath, bool isDirectory) | 197 void ResolveURICallbacks::didResolveURL(const String& name, const KURL& rootURL,
FileSystemType type, const String& filePath, bool isDirectory) |
| 198 { | 198 { |
| 199 DOMFileSystem* filesystem = DOMFileSystem::create(m_executionContext.get(),
name, type, rootURL); | 199 DOMFileSystem* filesystem = DOMFileSystem::create(m_executionContext.get(),
name, type, rootURL); |
| 200 DirectoryEntry* root = filesystem->root(); | 200 DirectoryEntry* root = filesystem->root(); |
| 201 | 201 |
| 202 String absolutePath; | 202 String absolutePath; |
| 203 if (!DOMFileSystemBase::pathToAbsolutePath(type, root, filePath, absolutePat
h)) { | 203 if (!DOMFileSystemBase::pathToAbsolutePath(type, root, filePath, absolutePat
h)) { |
| 204 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::crea
te(FileError::INVALID_MODIFICATION_ERR)); | 204 handleEventOrScheduleCallback(m_errorCallback.release(), FileError::INVA
LID_MODIFICATION_ERR); |
| 205 return; | 205 return; |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (isDirectory) | 208 if (isDirectory) |
| 209 handleEventOrScheduleCallback(m_successCallback.release(), DirectoryEntr
y::create(filesystem, absolutePath)); | 209 handleEventOrScheduleCallback(m_successCallback.release(), DirectoryEntr
y::create(filesystem, absolutePath)); |
| 210 else | 210 else |
| 211 handleEventOrScheduleCallback(m_successCallback.release(), FileEntry::cr
eate(filesystem, absolutePath)); | 211 handleEventOrScheduleCallback(m_successCallback.release(), FileEntry::cr
eate(filesystem, absolutePath)); |
| 212 } | 212 } |
| 213 | 213 |
| 214 // MetadataCallbacks ---------------------------------------------------------- | 214 // MetadataCallbacks ---------------------------------------------------------- |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 { | 292 { |
| 293 } | 293 } |
| 294 | 294 |
| 295 void VoidCallbacks::didSucceed() | 295 void VoidCallbacks::didSucceed() |
| 296 { | 296 { |
| 297 if (m_successCallback) | 297 if (m_successCallback) |
| 298 handleEventOrScheduleCallback(m_successCallback.release()); | 298 handleEventOrScheduleCallback(m_successCallback.release()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |