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

Side by Side Diff: Source/web/WebSharedWorkerImpl.h

Issue 1175463004: Cleanup: Remove WeakPtr usage in WebSharedWorkerImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more documentation Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/web/WebSharedWorkerImpl.cpp » ('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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 virtual int64_t serviceWorkerID(WebDataSource&) override; 91 virtual int64_t serviceWorkerID(WebDataSource&) override;
92 92
93 // WebDevToolsAgentClient overrides. 93 // WebDevToolsAgentClient overrides.
94 virtual void sendProtocolMessage(int callId, const WebString&, const WebStri ng&) override; 94 virtual void sendProtocolMessage(int callId, const WebString&, const WebStri ng&) override;
95 virtual void resumeStartup() override; 95 virtual void resumeStartup() override;
96 96
97 // WebSharedWorker methods: 97 // WebSharedWorker methods:
98 virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType) override; 98 virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType) override;
99 virtual void connect(WebMessagePortChannel*) override; 99 virtual void connect(WebMessagePortChannel*) override;
100 virtual void terminateWorkerContext() override; 100 virtual void terminateWorkerContext() override;
101 virtual void clientDestroyed() override;
102 101
103 virtual void pauseWorkerContextOnStart() override; 102 virtual void pauseWorkerContextOnStart() override;
104 virtual void attachDevTools(const WebString& hostId) override; 103 virtual void attachDevTools(const WebString& hostId) override;
105 virtual void reattachDevTools(const WebString& hostId, const WebString& save dState) override; 104 virtual void reattachDevTools(const WebString& hostId, const WebString& save dState) override;
106 virtual void detachDevTools() override; 105 virtual void detachDevTools() override;
107 virtual void dispatchDevToolsMessage(const WebString&) override; 106 virtual void dispatchDevToolsMessage(const WebString&) override;
108 107
109 private: 108 private:
110 class Loader; 109 class Loader;
111 110
112 virtual ~WebSharedWorkerImpl(); 111 virtual ~WebSharedWorkerImpl();
113 112
114 WebSharedWorkerClient* client() { return m_client->get(); }
115
116 void setWorkerThread(PassRefPtr<WorkerThread> thread) { m_workerThread = thr ead; } 113 void setWorkerThread(PassRefPtr<WorkerThread> thread) { m_workerThread = thr ead; }
117 WorkerThread* workerThread() { return m_workerThread.get(); } 114 WorkerThread* workerThread() { return m_workerThread.get(); }
118 115
119 // Shuts down the worker thread. 116 // Shuts down the worker thread.
120 void terminateWorkerThread(); 117 void terminateWorkerThread();
121 118
122 // Creates the shadow loader used for worker network requests. 119 // Creates the shadow loader used for worker network requests.
123 void initializeLoader(); 120 void initializeLoader();
124 121
125 void loadShadowPage(); 122 void loadShadowPage();
(...skipping 17 matching lines...) Expand all
143 WebLocalFrameImpl* m_mainFrame; 140 WebLocalFrameImpl* m_mainFrame;
144 bool m_askedToTerminate; 141 bool m_askedToTerminate;
145 142
146 // This one is bound to and used only on the main thread. 143 // This one is bound to and used only on the main thread.
147 OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; 144 OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider;
148 145
149 OwnPtr<WorkerInspectorProxy> m_workerInspectorProxy; 146 OwnPtr<WorkerInspectorProxy> m_workerInspectorProxy;
150 147
151 RefPtr<WorkerThread> m_workerThread; 148 RefPtr<WorkerThread> m_workerThread;
152 149
153 // This one's initialized and bound to the main thread. 150 WebSharedWorkerClient* m_client;
154 RefPtr<WeakReference<WebSharedWorkerClient>> m_client;
155
156 // Usually WeakPtr is created by WeakPtrFactory exposed by Client
157 // class itself, but here it's implemented by Chrome so we create
158 // our own WeakPtr.
159 WeakPtr<WebSharedWorkerClient> m_clientWeakPtr;
160 151
161 bool m_pauseWorkerContextOnStart; 152 bool m_pauseWorkerContextOnStart;
162 bool m_isPausedOnStart; 153 bool m_isPausedOnStart;
163 154
164 // Kept around only while main script loading is ongoing. 155 // Kept around only while main script loading is ongoing.
165 OwnPtr<Loader> m_mainScriptLoader; 156 OwnPtr<Loader> m_mainScriptLoader;
166 157
167 RefPtr<WorkerLoaderProxy> m_loaderProxy; 158 RefPtr<WorkerLoaderProxy> m_loaderProxy;
168 159
169 WebURL m_url; 160 WebURL m_url;
170 WebString m_name; 161 WebString m_name;
171 }; 162 };
172 163
173 } // namespace blink 164 } // namespace blink
174 165
175 #endif // WebSharedWorkerImpl_h 166 #endif // WebSharedWorkerImpl_h
OLDNEW
« no previous file with comments | « no previous file | Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698