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

Side by Side Diff: content/browser/shared_worker/shared_worker_host.h

Issue 182693002: Implement some mothods in SharedWorkerHost and SharedWorkerServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ 5 #ifndef CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_
6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ 6 #define CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string16.h"
12
13 class GURL;
14
15 namespace IPC {
16 class Message;
17 }
11 18
12 namespace content { 19 namespace content {
13 class SharedWorkerMessageFilter; 20 class SharedWorkerMessageFilter;
14 class SharedWorkerInstance; 21 class SharedWorkerInstance;
15 22
16 // The SharedWorkerHost is the interface that represents the browser side of 23 // The SharedWorkerHost is the interface that represents the browser side of
17 // the browser <-> worker communication channel. 24 // the browser <-> worker communication channel.
18 class SharedWorkerHost { 25 class SharedWorkerHost {
19 public: 26 public:
20 explicit SharedWorkerHost(SharedWorkerInstance* instance); 27 explicit SharedWorkerHost(SharedWorkerInstance* instance);
21 ~SharedWorkerHost(); 28 ~SharedWorkerHost();
22 29
30 // Sends the message to the SharedWorker in a renderer process.
kinuko 2014/02/27 11:34:44 nit: message -> |message| for parameters here and
horo 2014/02/28 04:59:14 Done.
31 bool Send(IPC::Message* message);
32
23 // Starts the SharedWorker in the renderer process which is associated with 33 // Starts the SharedWorker in the renderer process which is associated with
24 // |filter|. 34 // |filter|.
25 void Init(SharedWorkerMessageFilter* filter); 35 void Init(SharedWorkerMessageFilter* filter);
26 36
37 // Returns true iff the given message from a renderer process was forwarded to
38 // the worker.
39 bool FilterMessage(const IPC::Message& message,
40 SharedWorkerMessageFilter* filter);
41
42 // Handles the shutdown of the filter. If the worker has no other client,
43 // sends TerminateWorkerContext message to shut it down.
44 void FilterShutdown(SharedWorkerMessageFilter* filter);
45
46 // Shuts down any shared workers that are no longer referenced by active
47 // documents.
48 void DocumentDetached(SharedWorkerMessageFilter* filter,
49 unsigned long long document_id);
50
51 void WorkerContextClosed();
52 void WorkerScriptLoaded();
53 void WorkerScriptLoadFailed();
54 void WorkerConnected(int message_port_id);
55 void WorkerContextDestroyed();
56 void AllowDatabase(const GURL& url,
57 const base::string16& name,
58 const base::string16& display_name,
59 unsigned long estimated_size,
60 bool* result);
61 void AllowFileSystem(const GURL& url, bool* result);
62 void AllowIndexedDB(const GURL& url,
63 const base::string16& name,
64 bool* result);
65
27 SharedWorkerInstance* instance() { return instance_.get(); } 66 SharedWorkerInstance* instance() { return instance_.get(); }
67 SharedWorkerMessageFilter* parent_render_filter() const {
68 return parent_render_filter_;
69 }
28 int worker_route_id() const { return worker_route_id_; } 70 int worker_route_id() const { return worker_route_id_; }
29 71
30 private: 72 private:
73 // Relays a message to the given endpoint. Takes care of parsing the message
kinuko 2014/02/27 11:34:44 'given endpoint' is not obvious from the signature
horo 2014/02/28 04:59:14 Done.
74 // if it contains a message port and sending it a valid route id.
75 void RelayMessage(const IPC::Message& message,
76 SharedWorkerMessageFilter* incoming_filter);
77
31 scoped_ptr<SharedWorkerInstance> instance_; 78 scoped_ptr<SharedWorkerInstance> instance_;
79 SharedWorkerMessageFilter* parent_render_filter_;
kinuko 2014/02/27 11:34:44 Is this filter to talk to a shared worker, but not
horo 2014/02/28 04:59:14 Done.
80 int parent_render_process_id_;
32 int worker_route_id_; 81 int worker_route_id_;
33 82
34 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost); 83 DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost);
35 }; 84 };
36 } // namespace content 85 } // namespace content
37 86
38 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_ 87 #endif // CONTENT_BROWSER_SHARED_WORKER_SHARED_WORKER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698