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

Side by Side Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h

Issue 2811993007: Worker: Remove cross-thread PostTask functions from WorkerLoaderProxy (Closed)
Patch Set: address review comments Created 3 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 26 matching lines...) Expand all
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "public/platform/WebContentSecurityPolicy.h" 38 #include "public/platform/WebContentSecurityPolicy.h"
39 #include "public/web/WebDevToolsAgentClient.h" 39 #include "public/web/WebDevToolsAgentClient.h"
40 #include "public/web/WebEmbeddedWorker.h" 40 #include "public/web/WebEmbeddedWorker.h"
41 #include "public/web/WebEmbeddedWorkerStartData.h" 41 #include "public/web/WebEmbeddedWorkerStartData.h"
42 #include "public/web/WebFrameClient.h" 42 #include "public/web/WebFrameClient.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class ThreadableLoadingContext; 46 class ThreadableLoadingContext;
47 class ParentFrameTaskRunners;
48 class ServiceWorkerGlobalScopeProxy; 47 class ServiceWorkerGlobalScopeProxy;
49 class WebLocalFrameImpl; 48 class WebLocalFrameImpl;
50 class WebView; 49 class WebView;
51 class WorkerInspectorProxy; 50 class WorkerInspectorProxy;
52 class WorkerScriptLoader; 51 class WorkerScriptLoader;
53 class WorkerThread; 52 class WorkerThread;
54 53
55 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker, 54 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker,
56 public WebFrameClient, 55 public WebFrameClient,
57 public WebDevToolsAgentClient, 56 public WebDevToolsAgentClient,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const WebString&, 92 const WebString&,
94 const WebString&) override; 93 const WebString&) override;
95 void ResumeStartup() override; 94 void ResumeStartup() override;
96 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() 95 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop()
97 override; 96 override;
98 97
99 void OnScriptLoaderFinished(); 98 void OnScriptLoaderFinished();
100 void StartWorkerThread(); 99 void StartWorkerThread();
101 100
102 // WorkerLoaderProxyProvider 101 // WorkerLoaderProxyProvider
103 void PostTaskToLoader(const WebTraceLocation&,
104 std::unique_ptr<WTF::CrossThreadClosure>) override;
105 void PostTaskToWorkerGlobalScope(
106 const WebTraceLocation&,
107 std::unique_ptr<WTF::CrossThreadClosure>) override;
108 ThreadableLoadingContext* GetThreadableLoadingContext() override; 102 ThreadableLoadingContext* GetThreadableLoadingContext() override;
109 103
110 WebEmbeddedWorkerStartData worker_start_data_; 104 WebEmbeddedWorkerStartData worker_start_data_;
111 105
112 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; 106 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_;
113 107
114 // This is kept until startWorkerContext is called, and then passed on 108 // This is kept until startWorkerContext is called, and then passed on
115 // to WorkerContext. 109 // to WorkerContext.
116 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_; 110 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_;
117 111
118 // Kept around only while main script loading is ongoing. 112 // Kept around only while main script loading is ongoing.
119 RefPtr<WorkerScriptLoader> main_script_loader_; 113 RefPtr<WorkerScriptLoader> main_script_loader_;
120 114
121 // Owned by the main thread, but will be accessed by the worker when
122 // posting tasks.
123 CrossThreadPersistent<ParentFrameTaskRunners> main_thread_task_runners_;
124
125 std::unique_ptr<WorkerThread> worker_thread_; 115 std::unique_ptr<WorkerThread> worker_thread_;
126 RefPtr<WorkerLoaderProxy> loader_proxy_; 116 RefPtr<WorkerLoaderProxy> loader_proxy_;
127 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_; 117 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_;
128 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; 118 Persistent<WorkerInspectorProxy> worker_inspector_proxy_;
129 119
130 // 'shadow page' - created to proxy loading requests from the worker. 120 // 'shadow page' - created to proxy loading requests from the worker.
131 // Both WebView and WebFrame objects are close()'ed (where they're 121 // Both WebView and WebFrame objects are close()'ed (where they're
132 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they 122 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they
133 // are guaranteed to exist while this object is around. 123 // are guaranteed to exist while this object is around.
134 WebView* web_view_; 124 WebView* web_view_;
(...skipping 11 matching lines...) Expand all
146 kDoPauseAfterDownload, 136 kDoPauseAfterDownload,
147 kIsPausedAfterDownload 137 kIsPausedAfterDownload
148 } pause_after_download_state_; 138 } pause_after_download_state_;
149 139
150 WaitingForDebuggerState waiting_for_debugger_state_; 140 WaitingForDebuggerState waiting_for_debugger_state_;
151 }; 141 };
152 142
153 } // namespace blink 143 } // namespace blink
154 144
155 #endif // WebEmbeddedWorkerImpl_h 145 #endif // WebEmbeddedWorkerImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698