Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: WebKit/chromium/src/WorkerFileWriterCallbacksBridge.h

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 #include "KURL.h" 36 #include "KURL.h"
37 #include "WebFileError.h" 37 #include "WebFileError.h"
38 #include "WebFileWriterClient.h" 38 #include "WebFileWriterClient.h"
39 #include "WorkerContext.h" 39 #include "WorkerContext.h"
40 #include <wtf/PassOwnPtr.h> 40 #include <wtf/PassOwnPtr.h>
41 #include <wtf/PassRefPtr.h> 41 #include <wtf/PassRefPtr.h>
42 #include <wtf/ThreadSafeRefCounted.h> 42 #include <wtf/ThreadSafeRefCounted.h>
43 43
44 namespace WebCore { 44 namespace WebCore {
45 class AsyncFileWriterClient; 45 class AsyncFileWriterClient;
46 class BlobDataHandle;
46 class KURL; 47 class KURL;
47 class WorkerLoaderProxy; 48 class WorkerLoaderProxy;
48 } 49 }
49 50
50 namespace WTF { 51 namespace WTF {
51 class String; 52 class String;
52 } 53 }
53 using WTF::String; 54 using WTF::String;
54 55
55 namespace WebKit { 56 namespace WebKit {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 // WorkerContext::Observer method. 89 // WorkerContext::Observer method.
89 virtual void notifyStop(); 90 virtual void notifyStop();
90 91
91 static PassRefPtr<WorkerFileWriterCallbacksBridge> create(const WebCore::KUR L& path, WebCore::WorkerLoaderProxy* proxy, WebCore::ScriptExecutionContext* wor kerContext, WebCore::AsyncFileWriterClient* client) 92 static PassRefPtr<WorkerFileWriterCallbacksBridge> create(const WebCore::KUR L& path, WebCore::WorkerLoaderProxy* proxy, WebCore::ScriptExecutionContext* wor kerContext, WebCore::AsyncFileWriterClient* client)
92 { 93 {
93 return adoptRef(new WorkerFileWriterCallbacksBridge(path, proxy, workerC ontext, client)); 94 return adoptRef(new WorkerFileWriterCallbacksBridge(path, proxy, workerC ontext, client));
94 } 95 }
95 96
96 // Methods that create an instance and post an initial request task to the m ain thread. They must be called on the worker thread. 97 // Methods that create an instance and post an initial request task to the m ain thread. They must be called on the worker thread.
97 void postWriteToMainThread(long long position, const WebCore::KURL& data); 98 void postWriteToMainThread(long long position, PassRefPtr<WebCore::BlobDataH andle> blobDataHandle);
98 void postTruncateToMainThread(long long length); 99 void postTruncateToMainThread(long long length);
99 void postAbortToMainThread(); 100 void postAbortToMainThread();
100 101
101 // The owning WorkerAsyncFileWriterChromium should call this method before d ropping its last reference to the bridge, on the context thread. 102 // The owning WorkerAsyncFileWriterChromium should call this method before d ropping its last reference to the bridge, on the context thread.
102 // The actual deletion of the WorkerFileWriterCallbacksBridge may happen on either the main or context thread, depending on where the last reference goes aw ay; that's safe as long as this is called first. 103 // The actual deletion of the WorkerFileWriterCallbacksBridge may happen on either the main or context thread, depending on where the last reference goes aw ay; that's safe as long as this is called first.
103 void postShutdownToMainThread(PassRefPtr<WorkerFileWriterCallbacksBridge>); 104 void postShutdownToMainThread(PassRefPtr<WorkerFileWriterCallbacksBridge>);
104 105
105 // Callback methods that are called on the main thread. 106 // Callback methods that are called on the main thread.
106 // These are the implementation of WebKit::WebFileWriterClient. 107 // These are the implementation of WebKit::WebFileWriterClient.
107 void didWrite(long long bytes, bool complete); 108 void didWrite(long long bytes, bool complete);
108 void didFail(WebFileError); 109 void didFail(WebFileError);
109 void didTruncate(); 110 void didTruncate();
110 111
111 // Call this on the context thread to wait for the current operation to comp lete. 112 // Call this on the context thread to wait for the current operation to comp lete.
112 bool waitForOperationToComplete(); 113 bool waitForOperationToComplete();
113 114
114 private: 115 private:
115 WorkerFileWriterCallbacksBridge(const WebCore::KURL& path, WebCore::WorkerLo aderProxy*, WebCore::ScriptExecutionContext*, WebCore::AsyncFileWriterClient*); 116 WorkerFileWriterCallbacksBridge(const WebCore::KURL& path, WebCore::WorkerLo aderProxy*, WebCore::ScriptExecutionContext*, WebCore::AsyncFileWriterClient*);
116 117
117 void postInitToMainThread(const WebCore::KURL& path); 118 void postInitToMainThread(const WebCore::KURL& path);
118 119
119 // Methods that are to be called on the main thread. 120 // Methods that are to be called on the main thread.
120 static void writeOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<W orkerFileWriterCallbacksBridge>, long long position, const WebCore::KURL& data); 121 static void writeOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<W orkerFileWriterCallbacksBridge>, long long position, PassRefPtr<WebCore::BlobDat aHandle> blobDataHandle);
121 static void truncateOnMainThread(WebCore::ScriptExecutionContext*, PassRefPt r<WorkerFileWriterCallbacksBridge>, long long length); 122 static void truncateOnMainThread(WebCore::ScriptExecutionContext*, PassRefPt r<WorkerFileWriterCallbacksBridge>, long long length);
122 static void abortOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<W orkerFileWriterCallbacksBridge>); 123 static void abortOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<W orkerFileWriterCallbacksBridge>);
123 static void initOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<Wo rkerFileWriterCallbacksBridge>, const WebCore::KURL& path); 124 static void initOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<Wo rkerFileWriterCallbacksBridge>, const WebCore::KURL& path);
124 static void shutdownOnMainThread(WebCore::ScriptExecutionContext*, PassRefPt r<WorkerFileWriterCallbacksBridge>); 125 static void shutdownOnMainThread(WebCore::ScriptExecutionContext*, PassRefPt r<WorkerFileWriterCallbacksBridge>);
125 126
126 // Methods that dispatch to AsyncFileWriterClient on the worker threads. 127 // Methods that dispatch to AsyncFileWriterClient on the worker threads.
127 static void didWriteOnWorkerThread(WebCore::ScriptExecutionContext*, PassRef Ptr<WorkerFileWriterCallbacksBridge>, long long length, bool complete); 128 static void didWriteOnWorkerThread(WebCore::ScriptExecutionContext*, PassRef Ptr<WorkerFileWriterCallbacksBridge>, long long length, bool complete);
128 static void didFailOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefP tr<WorkerFileWriterCallbacksBridge>, WebFileError); 129 static void didFailOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefP tr<WorkerFileWriterCallbacksBridge>, WebFileError);
129 static void didTruncateOnWorkerThread(WebCore::ScriptExecutionContext*, Pass RefPtr<WorkerFileWriterCallbacksBridge>); 130 static void didTruncateOnWorkerThread(WebCore::ScriptExecutionContext*, Pass RefPtr<WorkerFileWriterCallbacksBridge>);
130 131
(...skipping 27 matching lines...) Expand all
158 159
159 // Used by postTaskForModeToWorkerContext and runInMode. 160 // Used by postTaskForModeToWorkerContext and runInMode.
160 String m_mode; 161 String m_mode;
161 }; 162 };
162 163
163 } // namespace WebCore 164 } // namespace WebCore
164 165
165 #endif 166 #endif
166 167
167 #endif // WorkerFileWriterCallbacksBridge_h 168 #endif // WorkerFileWriterCallbacksBridge_h
OLDNEW
« no previous file with comments | « WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp ('k') | WebKit/chromium/src/WorkerFileWriterCallbacksBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698