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

Side by Side Diff: Source/core/workers/Worker.h

Issue 1075603003: workers: Move core worker functionality into InProcessWorkerBase. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/InProcessWorkerBase.cpp ('k') | Source/core/workers/Worker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. 2 // Use of this source code is governed by a BSD-style license that can be
3 * 3 // found in the LICENSE file.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26 4
27 #ifndef Worker_h 5 #ifndef Worker_h
28 #define Worker_h 6 #define Worker_h
29 7
30 #include "core/CoreExport.h" 8 #include "core/workers/InProcessWorkerBase.h"
31 #include "core/dom/ActiveDOMObject.h"
32 #include "core/dom/MessagePort.h"
33 #include "core/events/EventListener.h"
34 #include "core/events/EventTarget.h"
35 #include "core/workers/AbstractWorker.h"
36 #include "core/workers/WorkerScriptLoaderClient.h"
37 #include "platform/heap/Handle.h"
38 #include "wtf/Forward.h"
39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefPtr.h"
41 #include "wtf/text/AtomicStringHash.h"
42 9
43 namespace blink { 10 namespace blink {
44 11
45 class ExceptionState; 12 class ExceptionState;
46 class ExecutionContext; 13 class ExecutionContext;
47 class WorkerGlobalScopeProxy; 14 class WorkerGlobalScopeProxy;
48 class WorkerScriptLoader; 15 class WorkerScriptLoader;
tkent 2015/04/14 01:02:48 nit: It's unnecessary
sadrul 2015/04/14 02:25:08 Done.
49 16
50 class CORE_EXPORT Worker : public AbstractWorker, private WorkerScriptLoaderClie nt { 17 class CORE_EXPORT Worker final : public InProcessWorkerBase {
51 DEFINE_WRAPPERTYPEINFO(); 18 DEFINE_WRAPPERTYPEINFO();
52 public: 19 public:
53 static PassRefPtrWillBeRawPtr<Worker> create(ExecutionContext*, const String & url, ExceptionState&); 20 static PassRefPtrWillBeRawPtr<Worker> create(ExecutionContext*, const String & url, ExceptionState&);
54 virtual ~Worker(); 21 virtual ~Worker();
55 22
56 virtual const AtomicString& interfaceName() const override;
57
58 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&);
59
60 bool initialize(ExecutionContext*, const String&, ExceptionState&);
61 void terminate();
62
63 virtual void stop() override;
64 virtual bool hasPendingActivity() const override;
65
66 DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
67
68 DECLARE_VIRTUAL_TRACE();
69
70 protected: 23 protected:
71 explicit Worker(ExecutionContext*); 24 explicit Worker(ExecutionContext*);
72 25
73 virtual WorkerGlobalScopeProxy* createWorkerGlobalScopeProxy(ExecutionContex t*); 26 WorkerGlobalScopeProxy* createWorkerGlobalScopeProxy(ExecutionContext*) over ride;
74 27 const AtomicString& interfaceName() const override;
75 private:
76 // WorkerScriptLoaderClient callbacks
77 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&) override;
78 virtual void notifyFinished() override;
79
80 RefPtr<WorkerScriptLoader> m_scriptLoader;
81 WorkerGlobalScopeProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown.
82 }; 28 };
83 29
84 } // namespace blink 30 } // namespace blink
85 31
86 #endif // Worker_h 32 #endif // Worker_h
OLDNEW
« no previous file with comments | « Source/core/workers/InProcessWorkerBase.cpp ('k') | Source/core/workers/Worker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698