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

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

Issue 374583002: Replace CallClosureTask::create(bind()) with createCrossThreadTask() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/workers/WorkerObjectProxy.h" 32 #include "core/workers/WorkerObjectProxy.h"
33 33
34 #include "bindings/core/v8/SerializedScriptValue.h" 34 #include "bindings/core/v8/SerializedScriptValue.h"
35 #include "core/dom/CrossThreadTask.h"
35 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
36 #include "core/dom/ExecutionContext.h" 37 #include "core/dom/ExecutionContext.h"
37 #include "core/workers/WorkerMessagingProxy.h" 38 #include "core/workers/WorkerMessagingProxy.h"
38 #include "platform/NotImplemented.h" 39 #include "platform/NotImplemented.h"
39 #include "wtf/Functional.h" 40 #include "wtf/Functional.h"
40 41
41 namespace WebCore { 42 namespace WebCore {
42 43
43 PassOwnPtr<WorkerObjectProxy> WorkerObjectProxy::create(ExecutionContext* execut ionContext, WorkerMessagingProxy* messagingProxy) 44 PassOwnPtr<WorkerObjectProxy> WorkerObjectProxy::create(ExecutionContext* execut ionContext, WorkerMessagingProxy* messagingProxy)
44 { 45 {
45 return adoptPtr(new WorkerObjectProxy(executionContext, messagingProxy)); 46 return adoptPtr(new WorkerObjectProxy(executionContext, messagingProxy));
46 } 47 }
47 48
48 void WorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptVal ue> message, PassOwnPtr<MessagePortChannelArray> channels) 49 void WorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptVal ue> message, PassOwnPtr<MessagePortChannelArray> channels)
49 { 50 {
50 m_executionContext->postTask(bind(&WorkerMessagingProxy::postMessageToWorker Object, m_messagingProxy, message, channels)); 51 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::po stMessageToWorkerObject, m_messagingProxy, message, channels));
51 } 52 }
52 53
53 void WorkerObjectProxy::postTaskToMainExecutionContext(PassOwnPtr<ExecutionConte xtTask> task) 54 void WorkerObjectProxy::postTaskToMainExecutionContext(PassOwnPtr<ExecutionConte xtTask> task)
54 { 55 {
55 m_executionContext->postTask(task); 56 m_executionContext->postTask(task);
56 } 57 }
57 58
58 void WorkerObjectProxy::confirmMessageFromWorkerObject(bool hasPendingActivity) 59 void WorkerObjectProxy::confirmMessageFromWorkerObject(bool hasPendingActivity)
59 { 60 {
60 m_executionContext->postTask(bind(&WorkerMessagingProxy::confirmMessageFromW orkerObject, m_messagingProxy, hasPendingActivity)); 61 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::co nfirmMessageFromWorkerObject, m_messagingProxy, hasPendingActivity));
61 } 62 }
62 63
63 void WorkerObjectProxy::reportPendingActivity(bool hasPendingActivity) 64 void WorkerObjectProxy::reportPendingActivity(bool hasPendingActivity)
64 { 65 {
65 m_executionContext->postTask(bind(&WorkerMessagingProxy::reportPendingActivi ty, m_messagingProxy, hasPendingActivity)); 66 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::re portPendingActivity, m_messagingProxy, hasPendingActivity));
66 } 67 }
67 68
68 void WorkerObjectProxy::reportException(const String& errorMessage, int lineNumb er, int columnNumber, const String& sourceURL) 69 void WorkerObjectProxy::reportException(const String& errorMessage, int lineNumb er, int columnNumber, const String& sourceURL)
69 { 70 {
70 m_executionContext->postTask(bind(&WorkerMessagingProxy::reportException, m_ messagingProxy, errorMessage.isolatedCopy(), lineNumber, columnNumber, sourceURL .isolatedCopy())); 71 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::re portException, m_messagingProxy, errorMessage, lineNumber, columnNumber, sourceU RL));
71 } 72 }
72 73
73 void WorkerObjectProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL) 74 void WorkerObjectProxy::reportConsoleMessage(MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
74 { 75 {
75 m_executionContext->postTask(bind(&WorkerMessagingProxy::reportConsoleMessag e, m_messagingProxy, source, level, message.isolatedCopy(), lineNumber, sourceUR L.isolatedCopy())); 76 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::re portConsoleMessage, m_messagingProxy, source, level, message, lineNumber, source URL));
76 } 77 }
77 78
78 void WorkerObjectProxy::postMessageToPageInspector(const String& message) 79 void WorkerObjectProxy::postMessageToPageInspector(const String& message)
79 { 80 {
80 if (m_executionContext->isDocument()) 81 if (m_executionContext->isDocument())
81 toDocument(m_executionContext)->postInspectorTask(bind(&WorkerMessagingP roxy::postMessageToPageInspector, m_messagingProxy, message.isolatedCopy())); 82 toDocument(m_executionContext)->postInspectorTask(createCrossThreadTask( &WorkerMessagingProxy::postMessageToPageInspector, m_messagingProxy, message));
82 } 83 }
83 84
84 void WorkerObjectProxy::updateInspectorStateCookie(const String&) 85 void WorkerObjectProxy::updateInspectorStateCookie(const String&)
85 { 86 {
86 notImplemented(); 87 notImplemented();
87 } 88 }
88 89
89 void WorkerObjectProxy::workerGlobalScopeClosed() 90 void WorkerObjectProxy::workerGlobalScopeClosed()
90 { 91 {
91 m_executionContext->postTask(bind(&WorkerMessagingProxy::terminateWorkerGlob alScope, m_messagingProxy)); 92 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::te rminateWorkerGlobalScope, m_messagingProxy));
92 } 93 }
93 94
94 void WorkerObjectProxy::workerGlobalScopeDestroyed() 95 void WorkerObjectProxy::workerGlobalScopeDestroyed()
95 { 96 {
96 // This will terminate the MessagingProxy. 97 // This will terminate the MessagingProxy.
97 m_executionContext->postTask(bind(&WorkerMessagingProxy::workerGlobalScopeDe stroyed, m_messagingProxy)); 98 m_executionContext->postTask(createCrossThreadTask(&WorkerMessagingProxy::wo rkerGlobalScopeDestroyed, m_messagingProxy));
98 } 99 }
99 100
100 WorkerObjectProxy::WorkerObjectProxy(ExecutionContext* executionContext, WorkerM essagingProxy* messagingProxy) 101 WorkerObjectProxy::WorkerObjectProxy(ExecutionContext* executionContext, WorkerM essagingProxy* messagingProxy)
101 : m_executionContext(executionContext) 102 : m_executionContext(executionContext)
102 , m_messagingProxy(messagingProxy) 103 , m_messagingProxy(messagingProxy)
103 { 104 {
104 } 105 }
105 106
106 } // namespace WebCore 107 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/NetworkStateNotifier.cpp ('k') | Source/modules/mediastream/MediaStreamTrackSourcesRequestImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698