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

Side by Side Diff: Source/core/loader/WorkerThreadableLoader.h

Issue 134443002: Update fetch / loader classes to use OVERRIDE / FINAL when needed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: No OVERRIDE / FINAL in web Created 6 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
« no previous file with comments | « Source/core/loader/TextTrackLoader.h ('k') | Source/core/loader/appcache/ApplicationCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 namespace WebCore { 44 namespace WebCore {
45 45
46 class ResourceError; 46 class ResourceError;
47 class ResourceRequest; 47 class ResourceRequest;
48 class WorkerGlobalScope; 48 class WorkerGlobalScope;
49 class WorkerLoaderProxy; 49 class WorkerLoaderProxy;
50 struct CrossThreadResourceResponseData; 50 struct CrossThreadResourceResponseData;
51 struct CrossThreadResourceRequestData; 51 struct CrossThreadResourceRequestData;
52 52
53 class WorkerThreadableLoader : public RefCounted<WorkerThreadableLoader>, pu blic ThreadableLoader { 53 class WorkerThreadableLoader FINAL : public RefCounted<WorkerThreadableLoade r>, public ThreadableLoader {
54 WTF_MAKE_FAST_ALLOCATED; 54 WTF_MAKE_FAST_ALLOCATED;
55 public: 55 public:
56 static void loadResourceSynchronously(WorkerGlobalScope*, const Resource Request&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); 56 static void loadResourceSynchronously(WorkerGlobalScope*, const Resource Request&, ThreadableLoaderClient&, const ThreadableLoaderOptions&);
57 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope* work erGlobalScope, ThreadableLoaderClient* client, const String& taskMode, const Res ourceRequest& request, const ThreadableLoaderOptions& options) 57 static PassRefPtr<WorkerThreadableLoader> create(WorkerGlobalScope* work erGlobalScope, ThreadableLoaderClient* client, const String& taskMode, const Res ourceRequest& request, const ThreadableLoaderOptions& options)
58 { 58 {
59 return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client , taskMode, request, options)); 59 return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client , taskMode, request, options));
60 } 60 }
61 61
62 ~WorkerThreadableLoader(); 62 virtual ~WorkerThreadableLoader();
63 63
64 virtual void cancel() OVERRIDE; 64 virtual void cancel() OVERRIDE;
65 65
66 bool done() const { return m_workerClientWrapper->done(); } 66 bool done() const { return m_workerClientWrapper->done(); }
67 67
68 using RefCounted<WorkerThreadableLoader>::ref; 68 using RefCounted<WorkerThreadableLoader>::ref;
69 using RefCounted<WorkerThreadableLoader>::deref; 69 using RefCounted<WorkerThreadableLoader>::deref;
70 70
71 protected: 71 protected:
72 virtual void refThreadableLoader() OVERRIDE { ref(); } 72 virtual void refThreadableLoader() OVERRIDE { ref(); }
(...skipping 12 matching lines...) Expand all
85 // case 1. worker.terminate is called. 85 // case 1. worker.terminate is called.
86 // In this case, no more tasks are posted from the worker object's th read to the worker 86 // In this case, no more tasks are posted from the worker object's th read to the worker
87 // context's thread -- WorkerGlobalScopeProxy implementation enforces this. 87 // context's thread -- WorkerGlobalScopeProxy implementation enforces this.
88 // 88 //
89 // case 2. xhr gets aborted and the worker context continues running. 89 // case 2. xhr gets aborted and the worker context continues running.
90 // The ThreadableLoaderClientWrapper has the underlying client cleare d, so no more calls 90 // The ThreadableLoaderClientWrapper has the underlying client cleare d, so no more calls
91 // go through it. All tasks posted from the worker object's thread t o the worker context's 91 // go through it. All tasks posted from the worker object's thread t o the worker context's
92 // thread do "ThreadableLoaderClientWrapper::ref" (automatically insi de of the cross thread copy 92 // thread do "ThreadableLoaderClientWrapper::ref" (automatically insi de of the cross thread copy
93 // done in createCallbackTask), so the ThreadableLoaderClientWrapper instance is there until all 93 // done in createCallbackTask), so the ThreadableLoaderClientWrapper instance is there until all
94 // tasks are executed. 94 // tasks are executed.
95 class MainThreadBridge : public ThreadableLoaderClient { 95 class MainThreadBridge FINAL : public ThreadableLoaderClient {
96 public: 96 public:
97 // All executed on the worker context's thread. 97 // All executed on the worker context's thread.
98 MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLo aderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoad erOptions&, const String& outgoingReferrer); 98 MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLo aderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoad erOptions&, const String& outgoingReferrer);
99 void cancel(); 99 void cancel();
100 void destroy(); 100 void destroy();
101 101
102 private: 102 private:
103 // Executed on the worker context's thread. 103 // Executed on the worker context's thread.
104 void clearClientWrapper(); 104 void clearClientWrapper();
105 105
106 // All executed on the main thread. 106 // All executed on the main thread.
107 static void mainThreadDestroy(ExecutionContext*, MainThreadBridge*); 107 static void mainThreadDestroy(ExecutionContext*, MainThreadBridge*);
108 ~MainThreadBridge(); 108 virtual ~MainThreadBridge();
109 109
110 static void mainThreadCreateLoader(ExecutionContext*, MainThreadBrid ge*, PassOwnPtr<CrossThreadResourceRequestData>, ThreadableLoaderOptions, const String& outgoingReferrer); 110 static void mainThreadCreateLoader(ExecutionContext*, MainThreadBrid ge*, PassOwnPtr<CrossThreadResourceRequestData>, ThreadableLoaderOptions, const String& outgoingReferrer);
111 static void mainThreadCancel(ExecutionContext*, MainThreadBridge*); 111 static void mainThreadCancel(ExecutionContext*, MainThreadBridge*);
112 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE; 112 virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) OVERRIDE;
113 virtual void didReceiveResponse(unsigned long identifier, const Reso urceResponse&) OVERRIDE; 113 virtual void didReceiveResponse(unsigned long identifier, const Reso urceResponse&) OVERRIDE;
114 virtual void didReceiveData(const char*, int dataLength) OVERRIDE; 114 virtual void didReceiveData(const char*, int dataLength) OVERRIDE;
115 virtual void didDownloadData(int dataLength) OVERRIDE; 115 virtual void didDownloadData(int dataLength) OVERRIDE;
116 virtual void didReceiveCachedMetadata(const char*, int dataLength) O VERRIDE; 116 virtual void didReceiveCachedMetadata(const char*, int dataLength) O VERRIDE;
117 virtual void didFinishLoading(unsigned long identifier, double finis hTime) OVERRIDE; 117 virtual void didFinishLoading(unsigned long identifier, double finis hTime) OVERRIDE;
118 virtual void didFail(const ResourceError&) OVERRIDE; 118 virtual void didFail(const ResourceError&) OVERRIDE;
(...skipping 17 matching lines...) Expand all
136 WorkerThreadableLoader(WorkerGlobalScope*, ThreadableLoaderClient*, cons t String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); 136 WorkerThreadableLoader(WorkerGlobalScope*, ThreadableLoaderClient*, cons t String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&);
137 137
138 RefPtr<WorkerGlobalScope> m_workerGlobalScope; 138 RefPtr<WorkerGlobalScope> m_workerGlobalScope;
139 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; 139 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper;
140 MainThreadBridge& m_bridge; 140 MainThreadBridge& m_bridge;
141 }; 141 };
142 142
143 } // namespace WebCore 143 } // namespace WebCore
144 144
145 #endif // WorkerThreadableLoader_h 145 #endif // WorkerThreadableLoader_h
OLDNEW
« no previous file with comments | « Source/core/loader/TextTrackLoader.h ('k') | Source/core/loader/appcache/ApplicationCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698