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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "WorkerAsyncFileWriterChromium.h" | 32 #include "WorkerAsyncFileWriterChromium.h" |
33 | 33 |
34 #include "WebFileWriter.h" | 34 #include "WebFileWriter.h" |
35 #include "WebWorkerBase.h" | 35 #include "WebWorkerBase.h" |
36 #include "WorkerFileWriterCallbacksBridge.h" | 36 #include "WorkerFileWriterCallbacksBridge.h" |
37 #include "core/dom/ScriptExecutionContext.h" | 37 #include "core/dom/ScriptExecutionContext.h" |
38 #include "core/fileapi/Blob.h" | 38 #include "core/fileapi/Blob.h" |
39 #include "core/platform/AsyncFileSystem.h" | 39 #include "core/platform/AsyncFileSystem.h" |
40 #include "core/workers/WorkerContext.h" | 40 #include "core/workers/WorkerGlobalScope.h" |
41 #include "core/workers/WorkerLoaderProxy.h" | 41 #include "core/workers/WorkerLoaderProxy.h" |
42 #include "core/workers/WorkerThread.h" | 42 #include "core/workers/WorkerThread.h" |
43 #include "public/platform/WebFileSystem.h" | 43 #include "public/platform/WebFileSystem.h" |
44 #include "public/platform/WebURL.h" | 44 #include "public/platform/WebURL.h" |
45 #include <wtf/Assertions.h> | 45 #include <wtf/Assertions.h> |
46 | 46 |
47 using namespace WebKit; | 47 using namespace WebKit; |
48 | 48 |
49 namespace WebCore { | 49 namespace WebCore { |
50 | 50 |
51 WorkerAsyncFileWriterChromium::WorkerAsyncFileWriterChromium(WebFileSystem* webF
ileSystem, const WebURL& path, WorkerContext* workerContext, AsyncFileWriterClie
nt* client, WriterType type) | 51 WorkerAsyncFileWriterChromium::WorkerAsyncFileWriterChromium(WebFileSystem* webF
ileSystem, const WebURL& path, WorkerGlobalScope* workerGlobalScope, AsyncFileWr
iterClient* client, WriterType type) |
52 { | 52 { |
53 ASSERT(type == Asynchronous); // Synchronous is not implemented yet. | 53 ASSERT(type == Asynchronous); // Synchronous is not implemented yet. |
54 | 54 |
55 WorkerLoaderProxy* proxy = &workerContext->thread()->workerLoaderProxy(); | 55 WorkerLoaderProxy* proxy = &workerGlobalScope->thread()->workerLoaderProxy()
; |
56 m_bridge = WorkerFileWriterCallbacksBridge::create(path, proxy, workerContex
t, client); | 56 m_bridge = WorkerFileWriterCallbacksBridge::create(path, proxy, workerGlobal
Scope, client); |
57 } | 57 } |
58 | 58 |
59 WorkerAsyncFileWriterChromium::~WorkerAsyncFileWriterChromium() | 59 WorkerAsyncFileWriterChromium::~WorkerAsyncFileWriterChromium() |
60 { | 60 { |
61 m_bridge->postShutdownToMainThread(m_bridge); | 61 m_bridge->postShutdownToMainThread(m_bridge); |
62 } | 62 } |
63 | 63 |
64 bool WorkerAsyncFileWriterChromium::waitForOperationToComplete() | 64 bool WorkerAsyncFileWriterChromium::waitForOperationToComplete() |
65 { | 65 { |
66 return m_bridge->waitForOperationToComplete(); | 66 return m_bridge->waitForOperationToComplete(); |
67 } | 67 } |
68 | 68 |
69 void WorkerAsyncFileWriterChromium::write(long long position, Blob* data) | 69 void WorkerAsyncFileWriterChromium::write(long long position, Blob* data) |
70 { | 70 { |
71 m_bridge->postWriteToMainThread(position, data->url()); | 71 m_bridge->postWriteToMainThread(position, data->url()); |
72 } | 72 } |
73 | 73 |
74 void WorkerAsyncFileWriterChromium::truncate(long long length) | 74 void WorkerAsyncFileWriterChromium::truncate(long long length) |
75 { | 75 { |
76 m_bridge->postTruncateToMainThread(length); | 76 m_bridge->postTruncateToMainThread(length); |
77 } | 77 } |
78 | 78 |
79 void WorkerAsyncFileWriterChromium::abort() | 79 void WorkerAsyncFileWriterChromium::abort() |
80 { | 80 { |
81 m_bridge->postAbortToMainThread(); | 81 m_bridge->postAbortToMainThread(); |
82 } | 82 } |
83 | 83 |
84 } | 84 } |
OLD | NEW |