| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 bool FileSystemCallbacksBase::shouldScheduleCallback() const | 80 bool FileSystemCallbacksBase::shouldScheduleCallback() const |
| 81 { | 81 { |
| 82 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon
text->activeDOMObjectsAreSuspended(); | 82 return !shouldBlockUntilCompletion() && m_executionContext && m_executionCon
text->activeDOMObjectsAreSuspended(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 template <typename CB, typename CBArg> | 85 template <typename CB, typename CBArg> |
| 86 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg*
arg) | 86 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback, CBArg*
arg) |
| 87 { | 87 { |
| 88 ASSERT(callback); | 88 ASSERT(callback); |
| 89 if (shouldScheduleCallback()) | 89 if (callback) { |
| 90 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback, arg)
; | 90 if (shouldScheduleCallback()) |
| 91 else if (callback) | 91 DOMFileSystem::scheduleCallback(m_executionContext.get(), createSame
ThreadTask(&CB::handleEvent, wrapPersistent(callback), wrapPersistent(arg))); |
| 92 callback->handleEvent(arg); | 92 else |
| 93 callback->handleEvent(arg); |
| 94 } |
| 93 m_executionContext.clear(); | 95 m_executionContext.clear(); |
| 94 } | 96 } |
| 95 | 97 |
| 96 template <typename CB> | 98 template <typename CB> |
| 97 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback) | 99 void FileSystemCallbacksBase::handleEventOrScheduleCallback(CB* callback) |
| 98 { | 100 { |
| 99 ASSERT(callback); | 101 ASSERT(callback); |
| 100 if (shouldScheduleCallback()) | 102 if (callback) { |
| 101 DOMFileSystem::scheduleCallback(m_executionContext.get(), callback); | 103 if (shouldScheduleCallback()) |
| 102 else if (callback) | 104 DOMFileSystem::scheduleCallback(m_executionContext.get(), createSame
ThreadTask(&CB::handleEvent, wrapPersistent(callback))); |
| 103 callback->handleEvent(); | 105 else |
| 106 callback->handleEvent(); |
| 107 } |
| 104 m_executionContext.clear(); | 108 m_executionContext.clear(); |
| 105 } | 109 } |
| 106 | 110 |
| 107 // EntryCallbacks ------------------------------------------------------------- | 111 // EntryCallbacks ------------------------------------------------------------- |
| 108 | 112 |
| 109 std::unique_ptr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback*
successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFil
eSystemBase* fileSystem, const String& expectedPath, bool isDirectory) | 113 std::unique_ptr<AsyncFileSystemCallbacks> EntryCallbacks::create(EntryCallback*
successCallback, ErrorCallback* errorCallback, ExecutionContext* context, DOMFil
eSystemBase* fileSystem, const String& expectedPath, bool isDirectory) |
| 110 { | 114 { |
| 111 return wrapUnique(new EntryCallbacks(successCallback, errorCallback, context
, fileSystem, expectedPath, isDirectory)); | 115 return wrapUnique(new EntryCallbacks(successCallback, errorCallback, context
, fileSystem, expectedPath, isDirectory)); |
| 112 } | 116 } |
| 113 | 117 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 { | 298 { |
| 295 } | 299 } |
| 296 | 300 |
| 297 void VoidCallbacks::didSucceed() | 301 void VoidCallbacks::didSucceed() |
| 298 { | 302 { |
| 299 if (m_successCallback) | 303 if (m_successCallback) |
| 300 handleEventOrScheduleCallback(m_successCallback.release()); | 304 handleEventOrScheduleCallback(m_successCallback.release()); |
| 301 } | 305 } |
| 302 | 306 |
| 303 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |