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

Side by Side Diff: third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp

Issue 1897193002: Worker: Rename worker components to clarify what they work for (part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 18 matching lines...) Expand all
29 #include "core/workers/InProcessWorkerMessagingProxy.h" 29 #include "core/workers/InProcessWorkerMessagingProxy.h"
30 30
31 #include "bindings/core/v8/V8GCController.h" 31 #include "bindings/core/v8/V8GCController.h"
32 #include "core/dom/CrossThreadTask.h" 32 #include "core/dom/CrossThreadTask.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/SecurityContext.h" 34 #include "core/dom/SecurityContext.h"
35 #include "core/events/ErrorEvent.h" 35 #include "core/events/ErrorEvent.h"
36 #include "core/events/MessageEvent.h" 36 #include "core/events/MessageEvent.h"
37 #include "core/frame/Console.h" 37 #include "core/frame/Console.h"
38 #include "core/frame/FrameConsole.h" 38 #include "core/frame/FrameConsole.h"
39 #include "core/frame/LocalDOMWindow.h"
40 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
41 #include "core/frame/csp/ContentSecurityPolicy.h" 40 #include "core/frame/csp/ContentSecurityPolicy.h"
42 #include "core/inspector/ConsoleMessage.h" 41 #include "core/inspector/ConsoleMessage.h"
43 #include "core/inspector/WorkerDebuggerAgent.h"
44 #include "core/loader/DocumentLoadTiming.h" 42 #include "core/loader/DocumentLoadTiming.h"
45 #include "core/loader/DocumentLoader.h" 43 #include "core/loader/DocumentLoader.h"
46 #include "core/workers/InProcessWorkerBase.h" 44 #include "core/workers/InProcessWorkerBase.h"
45 #include "core/workers/InProcessWorkerObjectProxy.h"
47 #include "core/workers/WorkerClients.h" 46 #include "core/workers/WorkerClients.h"
48 #include "core/workers/WorkerInspectorProxy.h" 47 #include "core/workers/WorkerInspectorProxy.h"
49 #include "core/workers/WorkerObjectProxy.h"
50 #include "core/workers/WorkerThreadStartupData.h" 48 #include "core/workers/WorkerThreadStartupData.h"
51 #include "platform/heap/Handle.h"
52 #include "wtf/Functional.h"
53 49
54 namespace blink { 50 namespace blink {
55 51
56 namespace { 52 namespace {
57 53
58 void processExceptionOnWorkerGlobalScope(int exceptionId, bool handled, Executio nContext* scriptContext) 54 void processExceptionOnWorkerGlobalScope(int exceptionId, bool handled, Executio nContext* scriptContext)
59 { 55 {
60 WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); 56 WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext);
61 globalScope->exceptionHandled(exceptionId, handled); 57 globalScope->exceptionHandled(exceptionId, handled);
62 } 58 }
63 59
64 void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message , PassOwnPtr<MessagePortChannelArray> channels, WorkerObjectProxy* workerObjectP roxy, ExecutionContext* scriptContext) 60 void processMessageOnWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message , PassOwnPtr<MessagePortChannelArray> channels, InProcessWorkerObjectProxy* work erObjectProxy, ExecutionContext* scriptContext)
65 { 61 {
66 WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext); 62 WorkerGlobalScope* globalScope = toWorkerGlobalScope(scriptContext);
67 MessagePortArray* ports = MessagePort::entanglePorts(*scriptContext, channel s); 63 MessagePortArray* ports = MessagePort::entanglePorts(*scriptContext, channel s);
68 globalScope->dispatchEvent(MessageEvent::create(ports, message)); 64 globalScope->dispatchEvent(MessageEvent::create(ports, message));
69 workerObjectProxy->confirmMessageFromWorkerObject(V8GCController::hasPending Activity(globalScope->thread()->isolate(), scriptContext)); 65 workerObjectProxy->confirmMessageFromWorkerObject(V8GCController::hasPending Activity(globalScope->thread()->isolate(), scriptContext));
70 } 66 }
71 67
72 } // namespace 68 } // namespace
73 69
74 InProcessWorkerMessagingProxy::InProcessWorkerMessagingProxy(InProcessWorkerBase * workerObject, WorkerClients* workerClients) 70 InProcessWorkerMessagingProxy::InProcessWorkerMessagingProxy(InProcessWorkerBase * workerObject, WorkerClients* workerClients)
75 : m_executionContext(workerObject->getExecutionContext()) 71 : m_executionContext(workerObject->getExecutionContext())
76 , m_workerObjectProxy(WorkerObjectProxy::create(this)) 72 , m_workerObjectProxy(InProcessWorkerObjectProxy::create(this))
77 , m_workerObject(workerObject) 73 , m_workerObject(workerObject)
78 , m_mayBeDestroyed(false) 74 , m_mayBeDestroyed(false)
79 , m_unconfirmedMessageCount(0) 75 , m_unconfirmedMessageCount(0)
80 , m_workerThreadHadPendingActivity(false) 76 , m_workerThreadHadPendingActivity(false)
81 , m_askedToTerminate(false) 77 , m_askedToTerminate(false)
82 , m_workerInspectorProxy(WorkerInspectorProxy::create()) 78 , m_workerInspectorProxy(WorkerInspectorProxy::create())
83 , m_workerClients(workerClients) 79 , m_workerClients(workerClients)
84 { 80 {
85 ASSERT(m_workerObject); 81 ASSERT(m_workerObject);
86 ASSERT((m_executionContext->isDocument() && isMainThread()) 82 ASSERT((m_executionContext->isDocument() && isMainThread())
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 279
284 // FIXME: This need to be revisited when we support nested worker one day 280 // FIXME: This need to be revisited when we support nested worker one day
285 ASSERT(m_executionContext->isDocument()); 281 ASSERT(m_executionContext->isDocument());
286 Document* document = toDocument(m_executionContext.get()); 282 Document* document = toDocument(m_executionContext.get());
287 LocalFrame* frame = document->frame(); 283 LocalFrame* frame = document->frame();
288 if (frame) 284 if (frame)
289 frame->console().adoptWorkerMessagesAfterTermination(m_workerInspectorPr oxy.get()); 285 frame->console().adoptWorkerMessagesAfterTermination(m_workerInspectorPr oxy.get());
290 } 286 }
291 287
292 } // namespace blink 288 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698