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

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

Issue 344833002: Oilpan: move MessagePortArray to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 6 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 MessageWorkerGlobalScopeTask(PassRefPtr<SerializedScriptValue> message, Pass OwnPtr<MessagePortChannelArray> channels) 65 MessageWorkerGlobalScopeTask(PassRefPtr<SerializedScriptValue> message, Pass OwnPtr<MessagePortChannelArray> channels)
66 : m_message(message) 66 : m_message(message)
67 , m_channels(channels) 67 , m_channels(channels)
68 { 68 {
69 } 69 }
70 70
71 virtual void performTask(ExecutionContext* scriptContext) 71 virtual void performTask(ExecutionContext* scriptContext)
72 { 72 {
73 ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope()); 73 ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
74 DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalS cope*>(scriptContext); 74 DedicatedWorkerGlobalScope* context = static_cast<DedicatedWorkerGlobalS cope*>(scriptContext);
75 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*scriptConte xt, m_channels.release()); 75 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts( *scriptContext, m_channels.release());
76 context->dispatchEvent(MessageEvent::create(ports.release(), m_message)) ; 76 context->dispatchEvent(MessageEvent::create(ports.release(), m_message)) ;
77 context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(co ntext->hasPendingActivity()); 77 context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(co ntext->hasPendingActivity());
78 } 78 }
79 79
80 private: 80 private:
81 RefPtr<SerializedScriptValue> m_message; 81 RefPtr<SerializedScriptValue> m_message;
82 OwnPtr<MessagePortChannelArray> m_channels; 82 OwnPtr<MessagePortChannelArray> m_channels;
83 }; 83 };
84 84
85 WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject, PassOwnPtrWillB eRawPtr<WorkerClients> workerClients) 85 WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject, PassOwnPtrWillB eRawPtr<WorkerClients> workerClients)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 workerThreadCreated(thread); 118 workerThreadCreated(thread);
119 thread->start(); 119 thread->start();
120 InspectorInstrumentation::didStartWorkerGlobalScope(m_executionContext.get() , this, scriptURL); 120 InspectorInstrumentation::didStartWorkerGlobalScope(m_executionContext.get() , this, scriptURL);
121 } 121 }
122 122
123 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript Value> message, PassOwnPtr<MessagePortChannelArray> channels) 123 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript Value> message, PassOwnPtr<MessagePortChannelArray> channels)
124 { 124 {
125 if (!m_workerObject || m_askedToTerminate) 125 if (!m_workerObject || m_askedToTerminate)
126 return; 126 return;
127 127
128 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_executionCont ext.get(), channels); 128 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_e xecutionContext.get(), channels);
129 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message) ); 129 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message) );
130 } 130 }
131 131
132 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedS criptValue> message, PassOwnPtr<MessagePortChannelArray> channels) 132 void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedS criptValue> message, PassOwnPtr<MessagePortChannelArray> channels)
133 { 133 {
134 if (m_askedToTerminate) 134 if (m_askedToTerminate)
135 return; 135 return;
136 136
137 if (m_workerThread) { 137 if (m_workerThread) {
138 ++m_unconfirmedMessageCount; 138 ++m_unconfirmedMessageCount;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 { 297 {
298 m_workerThreadHadPendingActivity = hasPendingActivity; 298 m_workerThreadHadPendingActivity = hasPendingActivity;
299 } 299 }
300 300
301 bool WorkerMessagingProxy::hasPendingActivity() const 301 bool WorkerMessagingProxy::hasPendingActivity() const
302 { 302 {
303 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m _askedToTerminate; 303 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m _askedToTerminate;
304 } 304 }
305 305
306 } // namespace WebCore 306 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/SharedWorkerGlobalScope.cpp ('k') | Source/modules/serviceworkers/ServiceWorkerContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698