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

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

Issue 1115923002: workers: Rename WorkerThread to WorkerScript. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 23 matching lines...) Expand all
34 #include "wtf/Forward.h" 34 #include "wtf/Forward.h"
35 #include "wtf/Noncopyable.h" 35 #include "wtf/Noncopyable.h"
36 #include "wtf/PassOwnPtr.h" 36 #include "wtf/PassOwnPtr.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
39 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class WorkerObjectProxy; 43 class WorkerObjectProxy;
44 class WorkerThread; 44 class WorkerScript;
45 class ExecutionContext; 45 class ExecutionContext;
46 class InProcessWorkerBase; 46 class InProcessWorkerBase;
47 class WorkerClients; 47 class WorkerClients;
48 class WorkerInspectorProxy; 48 class WorkerInspectorProxy;
49 49
50 class CORE_EXPORT WorkerMessagingProxy 50 class CORE_EXPORT WorkerMessagingProxy
51 : public WorkerGlobalScopeProxy 51 : public WorkerGlobalScopeProxy
52 , private WorkerLoaderProxyProvider { 52 , private WorkerLoaderProxyProvider {
53 WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); 53 WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy);
54 public: 54 public:
55 // Implementations of WorkerGlobalScopeProxy. 55 // Implementations of WorkerGlobalScopeProxy.
56 // (Only use these methods in the worker object thread.) 56 // (Only use these methods in the worker object thread.)
57 virtual void startWorkerGlobalScope(const KURL& scriptURL, const String& use rAgent, const String& sourceCode, WorkerThreadStartMode) override; 57 virtual void startWorkerGlobalScope(const KURL& scriptURL, const String& use rAgent, const String& sourceCode, WorkerThreadStartMode) override;
58 virtual void terminateWorkerGlobalScope() override; 58 virtual void terminateWorkerGlobalScope() override;
59 virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue >, PassOwnPtr<MessagePortChannelArray>) override; 59 virtual void postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue >, PassOwnPtr<MessagePortChannelArray>) override;
60 virtual bool hasPendingActivity() const override; 60 virtual bool hasPendingActivity() const override;
61 virtual void workerObjectDestroyed() override; 61 virtual void workerObjectDestroyed() override;
62 62
63 // These methods come from worker context thread via WorkerObjectProxy 63 // These methods come from worker context thread via WorkerObjectProxy
64 // and are called on the worker object thread (e.g. main thread). 64 // and are called on the worker object thread (e.g. main thread).
65 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr <MessagePortChannelArray>); 65 void postMessageToWorkerObject(PassRefPtr<SerializedScriptValue>, PassOwnPtr <MessagePortChannelArray>);
66 void reportException(const String& errorMessage, int lineNumber, int columnN umber, const String& sourceURL, int exceptionId); 66 void reportException(const String& errorMessage, int lineNumber, int columnN umber, const String& sourceURL, int exceptionId);
67 void reportConsoleMessage(MessageSource, MessageLevel, const String& message , int lineNumber, const String& sourceURL); 67 void reportConsoleMessage(MessageSource, MessageLevel, const String& message , int lineNumber, const String& sourceURL);
68 void postMessageToPageInspector(const String&); 68 void postMessageToPageInspector(const String&);
69 void postWorkerConsoleAgentEnabled(); 69 void postWorkerConsoleAgentEnabled();
70 WorkerInspectorProxy* workerInspectorProxy(); 70 WorkerInspectorProxy* workerInspectorProxy();
71 void confirmMessageFromWorkerObject(bool hasPendingActivity); 71 void confirmMessageFromWorkerObject(bool hasPendingActivity);
72 void reportPendingActivity(bool hasPendingActivity); 72 void reportPendingActivity(bool hasPendingActivity);
73 void workerGlobalScopeClosed(); 73 void workerGlobalScopeClosed();
74 void workerThreadTerminated(); 74 void workerScriptTerminated();
75 75
76 void workerThreadCreated(PassRefPtr<WorkerThread>); 76 void workerScriptCreated(PassRefPtr<WorkerScript>);
77 77
78 protected: 78 protected:
79 WorkerMessagingProxy(InProcessWorkerBase*, PassOwnPtrWillBeRawPtr<WorkerClie nts>); 79 WorkerMessagingProxy(InProcessWorkerBase*, PassOwnPtrWillBeRawPtr<WorkerClie nts>);
80 virtual ~WorkerMessagingProxy(); 80 virtual ~WorkerMessagingProxy();
81 81
82 virtual PassRefPtr<WorkerThread> createWorkerThread(double originTime, PassO wnPtr<WorkerThreadStartupData>) = 0; 82 virtual PassRefPtr<WorkerScript> createWorkerScript(double originTime, PassO wnPtr<WorkerScriptStartupData>) = 0;
83 83
84 PassRefPtr<WorkerLoaderProxy> loaderProxy() { return m_loaderProxy; } 84 PassRefPtr<WorkerLoaderProxy> loaderProxy() { return m_loaderProxy; }
85 WorkerObjectProxy& workerObjectProxy() { return *m_workerObjectProxy.get(); } 85 WorkerObjectProxy& workerObjectProxy() { return *m_workerObjectProxy.get(); }
86 86
87 private: 87 private:
88 void workerObjectDestroyedInternal(); 88 void workerObjectDestroyedInternal();
89 void terminateInternally(); 89 void terminateInternally();
90 90
91 // WorkerLoaderProxyProvider 91 // WorkerLoaderProxyProvider
92 // These methods are called on different threads to schedule loading 92 // These methods are called on different threads to schedule loading
93 // requests and to send callbacks back to WorkerGlobalScope. 93 // requests and to send callbacks back to WorkerGlobalScope.
94 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) override; 94 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask>) override;
95 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>) o verride; 95 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask>) o verride;
96 96
97 RefPtrWillBePersistent<ExecutionContext> m_executionContext; 97 RefPtrWillBePersistent<ExecutionContext> m_executionContext;
98 OwnPtr<WorkerObjectProxy> m_workerObjectProxy; 98 OwnPtr<WorkerObjectProxy> m_workerObjectProxy;
99 InProcessWorkerBase* m_workerObject; 99 InProcessWorkerBase* m_workerObject;
100 bool m_mayBeDestroyed; 100 bool m_mayBeDestroyed;
101 RefPtr<WorkerThread> m_workerThread; 101 RefPtr<WorkerScript> m_workerScript;
102 102
103 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje ct to worker thread. 103 unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker obje ct to worker thread.
104 bool m_workerThreadHadPendingActivity; // The latest confirmation from worke r thread reported that it was still active. 104 bool m_workerScriptHadPendingActivity; // The latest confirmation from worke r thread reported that it was still active.
105 105
106 bool m_askedToTerminate; 106 bool m_askedToTerminate;
107 107
108 Vector<OwnPtr<ExecutionContextTask>> m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created. 108 Vector<OwnPtr<ExecutionContextTask>> m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
109 OwnPtr<WorkerInspectorProxy> m_workerInspectorProxy; 109 OwnPtr<WorkerInspectorProxy> m_workerInspectorProxy;
110 110
111 OwnPtrWillBePersistent<WorkerClients> m_workerClients; 111 OwnPtrWillBePersistent<WorkerClients> m_workerClients;
112 112
113 RefPtr<WorkerLoaderProxy> m_loaderProxy; 113 RefPtr<WorkerLoaderProxy> m_loaderProxy;
114 }; 114 };
115 115
116 } // namespace blink 116 } // namespace blink
117 117
118 #endif // WorkerMessagingProxy_h 118 #endif // WorkerMessagingProxy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698