| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "WebFileSystemCallbacksImpl.h" | 31 #include "WebFileSystemCallbacksImpl.h" |
| 32 | 32 |
| 33 #include "AsyncFileSystemChromium.h" | 33 #include "AsyncFileSystemChromium.h" |
| 34 #include "AsyncFileWriterChromium.h" |
| 34 #include "WorkerAsyncFileSystemChromium.h" | 35 #include "WorkerAsyncFileSystemChromium.h" |
| 35 #include "core/dom/ScriptExecutionContext.h" | 36 #include "core/dom/ScriptExecutionContext.h" |
| 36 #include "core/platform/AsyncFileSystemCallbacks.h" | 37 #include "core/platform/AsyncFileSystemCallbacks.h" |
| 37 #include "core/platform/FileMetadata.h" | 38 #include "core/platform/FileMetadata.h" |
| 38 #include "public/platform/WebFileInfo.h" | 39 #include "public/platform/WebFileInfo.h" |
| 39 #include "public/platform/WebFileSystem.h" | 40 #include "public/platform/WebFileSystem.h" |
| 40 #include "public/platform/WebFileSystemEntry.h" | 41 #include "public/platform/WebFileSystemEntry.h" |
| 41 #include "public/platform/WebString.h" | 42 #include "public/platform/WebString.h" |
| 43 #include "public/web/WebFileWriter.h" |
| 42 #include "wtf/Vector.h" | 44 #include "wtf/Vector.h" |
| 43 | 45 |
| 44 using namespace WebCore; | 46 using namespace WebCore; |
| 45 | 47 |
| 46 namespace WebKit { | 48 namespace WebKit { |
| 47 | 49 |
| 48 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSyste
mCallbacks> callbacks, ScriptExecutionContext* context, FileSystemSynchronousTyp
e synchronousType) | 50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSyste
mCallbacks> callbacks, ScriptExecutionContext* context, FileSystemSynchronousTyp
e synchronousType) |
| 49 : m_callbacks(callbacks) | 51 : m_callbacks(callbacks) |
| 50 , m_context(context) | 52 , m_context(context) |
| 51 , m_synchronousType(synchronousType) | 53 , m_synchronousType(synchronousType) |
| 52 { | 54 { |
| 53 ASSERT(m_callbacks); | 55 ASSERT(m_callbacks); |
| 54 } | 56 } |
| 55 | 57 |
| 58 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSyste
mCallbacks> callbacks, PassOwnPtr<AsyncFileWriterChromium> writer) |
| 59 : m_callbacks(callbacks) |
| 60 , m_context(0) |
| 61 , m_writer(writer) |
| 62 { |
| 63 ASSERT(m_callbacks); |
| 64 } |
| 65 |
| 56 WebFileSystemCallbacksImpl::~WebFileSystemCallbacksImpl() | 66 WebFileSystemCallbacksImpl::~WebFileSystemCallbacksImpl() |
| 57 { | 67 { |
| 58 } | 68 } |
| 59 | 69 |
| 60 void WebFileSystemCallbacksImpl::didSucceed() | 70 void WebFileSystemCallbacksImpl::didSucceed() |
| 61 { | 71 { |
| 62 m_callbacks->didSucceed(); | 72 m_callbacks->didSucceed(); |
| 63 delete this; | 73 delete this; |
| 64 } | 74 } |
| 65 | 75 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // This object is intended to delete itself on exit. | 118 // This object is intended to delete itself on exit. |
| 109 OwnPtr<WebFileSystemCallbacksImpl> callbacks = adoptPtr(this); | 119 OwnPtr<WebFileSystemCallbacksImpl> callbacks = adoptPtr(this); |
| 110 | 120 |
| 111 if (m_context && m_context->isWorkerGlobalScope()) { | 121 if (m_context && m_context->isWorkerGlobalScope()) { |
| 112 m_callbacks->didOpenFileSystem(name, rootURL, WorkerAsyncFileSystemChrom
ium::create(m_context, m_synchronousType)); | 122 m_callbacks->didOpenFileSystem(name, rootURL, WorkerAsyncFileSystemChrom
ium::create(m_context, m_synchronousType)); |
| 113 return; | 123 return; |
| 114 } | 124 } |
| 115 m_callbacks->didOpenFileSystem(name, rootURL, AsyncFileSystemChromium::creat
e()); | 125 m_callbacks->didOpenFileSystem(name, rootURL, AsyncFileSystemChromium::creat
e()); |
| 116 } | 126 } |
| 117 | 127 |
| 128 void WebFileSystemCallbacksImpl::didCreateFileWriter(WebFileWriter* webFileWrite
r, long long length) |
| 129 { |
| 130 // This object is intended to delete itself on exit. |
| 131 OwnPtr<WebFileSystemCallbacksImpl> callbacks = adoptPtr(this); |
| 132 |
| 133 m_writer->setWebFileWriter(adoptPtr(webFileWriter)); |
| 134 m_callbacks->didCreateFileWriter(m_writer.release(), length); |
| 135 } |
| 136 |
| 118 void WebFileSystemCallbacksImpl::didFail(WebFileError error) | 137 void WebFileSystemCallbacksImpl::didFail(WebFileError error) |
| 119 { | 138 { |
| 120 m_callbacks->didFail(error); | 139 m_callbacks->didFail(error); |
| 121 delete this; | 140 delete this; |
| 122 } | 141 } |
| 123 | 142 |
| 124 bool WebFileSystemCallbacksImpl::shouldBlockUntilCompletion() const | 143 bool WebFileSystemCallbacksImpl::shouldBlockUntilCompletion() const |
| 125 { | 144 { |
| 126 return m_callbacks->shouldBlockUntilCompletion(); | 145 return m_callbacks->shouldBlockUntilCompletion(); |
| 127 } | 146 } |
| 128 | 147 |
| 129 } // namespace WebKit | 148 } // namespace WebKit |
| OLD | NEW |