blob: ccff6f199d2d7b89dd5b2e191fcee9a3e63b10ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
#define CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
#include "base/basictypes.h"
#include "chrome/common/ipc_channel.h"
#include "googleurl/src/gurl.h"
#include "webkit/api/public/WebWorkerClient.h"
namespace WebKit {
class WebWorker;
}
// This class receives IPCs from the renderer and calls the WebCore::Worker
// implementation (after the data types have been converted by glue code). It
// is also called by the worker code and converts these function calls into
// IPCs that are sent to the renderer, where they're converted back to function
// calls by WebWorkerProxy.
class WebWorkerClientProxy : public WebKit::WebWorkerClient,
public IPC::Channel::Listener {
public:
WebWorkerClientProxy(const GURL& url, int route_id);
// WebWorkerClient implementation.
virtual void postMessageToWorkerObject(const WebKit::WebString& message);
virtual void postExceptionToWorkerObject(
const WebKit::WebString& error_message,
int line_number,
const WebKit::WebString& source_url);
virtual void postConsoleMessageToWorkerObject(
int destination,
int source,
int level,
const WebKit::WebString& message,
int line_number,
const WebKit::WebString& source_url);
virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
virtual void reportPendingActivity(bool has_pending_activity);
virtual void workerContextDestroyed();
virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client);
// IPC::Channel::Listener implementation.
virtual void OnMessageReceived(const IPC::Message& message);
private:
~WebWorkerClientProxy ();
bool Send(IPC::Message* message);
void OnTerminateWorkerContext();
// The source url for this worker.
GURL url_;
int route_id_;
WebKit::WebWorker* impl_;
DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy);
};
#endif // CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
|