blob: aa192e78bd4abdeb99a68ca734e3144231796fa8 (
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
66
67
|
// 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_TEST_WORKER_TEST_WEBWORKER_H_
#define CHROME_TEST_WORKER_TEST_WEBWORKER_H_
#if ENABLE(WORKERS)
#include <vector>
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "webkit/glue/webworker.h"
#include "webkit/glue/webworkerclient.h"
class GURL;
class TestWebWorkerHelper;
class TestWebWorker : public WebWorker,
public WebWorkerClient,
public base::RefCounted<TestWebWorker> {
public:
TestWebWorker(WebWorkerClient* client, TestWebWorkerHelper* webworker_helper);
// WebWorker implementation.
virtual void StartWorkerContext(const GURL& script_url,
const string16& user_agent,
const string16& source_code);
virtual void TerminateWorkerContext();
virtual void PostMessageToWorkerContext(const string16& message);
virtual void WorkerObjectDestroyed();
// WebWorkerClient implementation.
virtual void PostMessageToWorkerObject(const string16& message);
virtual void PostExceptionToWorkerObject(
const string16& error_message,
int line_number,
const string16& source_url);
virtual void PostConsoleMessageToWorkerObject(
int destination,
int source,
int level,
const string16& message,
int line_number,
const string16& source_url);
virtual void ConfirmMessageFromWorkerObject(bool has_pending_activity);
virtual void ReportPendingActivity(bool has_pending_activity);
virtual void WorkerContextDestroyed();
private:
friend class base::RefCounted<TestWebWorker>;
virtual ~TestWebWorker();
static void InvokeMainThreadMethod(void* param);
WebWorkerClient* webworkerclient_delegate_;
WebWorker* webworker_impl_;
TestWebWorkerHelper* webworker_helper_;
std::vector<string16> queued_messages_;
DISALLOW_COPY_AND_ASSIGN(TestWebWorker);
};
#endif
#endif // CHROME_TEST_WORKER_TEST_WEBWORKER_H_
|