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

Side by Side Diff: content/renderer/websharedworker_proxy.h

Issue 2623613004: SharedWorker: Move classes under content/renderer to content/renderer/shared_worker (Closed)
Patch Set: fix include guards Created 3 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 | « content/renderer/shared_worker_repository.cc ('k') | content/renderer/websharedworker_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_
6 #define CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "ipc/ipc_listener.h"
14 #include "third_party/WebKit/public/web/WebSharedWorkerConnector.h"
15 #include "url/gurl.h"
16
17 namespace IPC {
18 class MessageRouter;
19 }
20
21 namespace content {
22
23 // Implementation of the WebSharedWorker APIs. This object is intended to only
24 // live long enough to allow the caller to send a "connect" event to the worker
25 // thread. Once the connect event has been sent, all future communication will
26 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will
27 // be freed.
28 class WebSharedWorkerProxy : public blink::WebSharedWorkerConnector,
29 private IPC::Listener {
30 public:
31 WebSharedWorkerProxy(IPC::MessageRouter* router, int route_id);
32 ~WebSharedWorkerProxy() override;
33
34 // Implementations of WebSharedWorkerConnector APIs
35 void connect(blink::WebMessagePortChannel* channel,
36 ConnectListener* listener) override;
37
38 private:
39 // IPC::Listener implementation.
40 bool OnMessageReceived(const IPC::Message& message) override;
41
42 // Sends a message to the worker thread (forwarded via the RenderViewHost).
43 // If WorkerStarted() has not yet been called, message is queued.
44 bool Send(std::unique_ptr<IPC::Message> message);
45
46 // Sends any messages currently in the queue.
47 void SendQueuedMessages();
48
49 void OnWorkerCreated();
50 void OnWorkerScriptLoadFailed();
51 void OnWorkerConnected();
52
53 // Routing id associated with this worker - used to receive messages from the
54 // worker, and also to route messages to the worker (WorkerService contains
55 // a map that maps between these renderer-side route IDs and worker-side
56 // routing ids).
57 const int route_id_;
58
59 IPC::MessageRouter* const router_;
60
61 // Stores messages that were sent before the StartWorkerContext message.
62 std::vector<std::unique_ptr<IPC::Message>> queued_messages_;
63
64 ConnectListener* connect_listener_;
65 bool created_;
66
67 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_RENDERER_WEBSHAREDWORKER_PROXY_H_
OLDNEW
« no previous file with comments | « content/renderer/shared_worker_repository.cc ('k') | content/renderer/websharedworker_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698