| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 void FileSystemCallbacksBase::didFail(int code) { | 75 void FileSystemCallbacksBase::didFail(int code) { |
| 76 if (m_errorCallback) | 76 if (m_errorCallback) |
| 77 invokeOrScheduleCallback(m_errorCallback.release(), | 77 invokeOrScheduleCallback(m_errorCallback.release(), |
| 78 static_cast<FileError::ErrorCode>(code)); | 78 static_cast<FileError::ErrorCode>(code)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool FileSystemCallbacksBase::shouldScheduleCallback() const { | 81 bool FileSystemCallbacksBase::shouldScheduleCallback() const { |
| 82 return !shouldBlockUntilCompletion() && m_executionContext && | 82 return !shouldBlockUntilCompletion() && m_executionContext && |
| 83 m_executionContext->activeDOMObjectsAreSuspended(); | 83 m_executionContext->isContextSuspended(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 template <typename CB, typename CBArg> | 86 template <typename CB, typename CBArg> |
| 87 void FileSystemCallbacksBase::invokeOrScheduleCallback(CB* callback, | 87 void FileSystemCallbacksBase::invokeOrScheduleCallback(CB* callback, |
| 88 CBArg arg) { | 88 CBArg arg) { |
| 89 DCHECK(callback); | 89 DCHECK(callback); |
| 90 if (callback) { | 90 if (callback) { |
| 91 if (shouldScheduleCallback()) | 91 if (shouldScheduleCallback()) |
| 92 DOMFileSystem::scheduleCallback( | 92 DOMFileSystem::scheduleCallback( |
| 93 m_executionContext.get(), | 93 m_executionContext.get(), |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 DOMFileSystemBase* fileSystem) | 418 DOMFileSystemBase* fileSystem) |
| 419 : FileSystemCallbacksBase(errorCallback, fileSystem, context), | 419 : FileSystemCallbacksBase(errorCallback, fileSystem, context), |
| 420 m_successCallback(successCallback) {} | 420 m_successCallback(successCallback) {} |
| 421 | 421 |
| 422 void VoidCallbacks::didSucceed() { | 422 void VoidCallbacks::didSucceed() { |
| 423 if (m_successCallback) | 423 if (m_successCallback) |
| 424 handleEventOrScheduleCallback(m_successCallback.release()); | 424 handleEventOrScheduleCallback(m_successCallback.release()); |
| 425 } | 425 } |
| 426 | 426 |
| 427 } // namespace blink | 427 } // namespace blink |
| OLD | NEW |