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

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

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month 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/SharedWorker.cpp ('k') | Source/core/workers/WorkerGlobalScope.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 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2010 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 inline Worker::Worker(ExecutionContext* context) 47 inline Worker::Worker(ExecutionContext* context)
48 : AbstractWorker(context) 48 : AbstractWorker(context)
49 , m_contextProxy(WorkerGlobalScopeProxy::create(this)) 49 , m_contextProxy(WorkerGlobalScopeProxy::create(this))
50 { 50 {
51 ScriptWrappable::init(this); 51 ScriptWrappable::init(this);
52 } 52 }
53 53
54 PassRefPtr<Worker> Worker::create(ExecutionContext* context, const String& url, ExceptionState& es) 54 PassRefPtr<Worker> Worker::create(ExecutionContext* context, const String& url, ExceptionState& exceptionState)
55 { 55 {
56 ASSERT(isMainThread()); 56 ASSERT(isMainThread());
57 UseCounter::count(toDocument(context)->domWindow(), UseCounter::WorkerStart) ; 57 UseCounter::count(toDocument(context)->domWindow(), UseCounter::WorkerStart) ;
58 58
59 RefPtr<Worker> worker = adoptRef(new Worker(context)); 59 RefPtr<Worker> worker = adoptRef(new Worker(context));
60 60
61 worker->suspendIfNeeded(); 61 worker->suspendIfNeeded();
62 62
63 KURL scriptURL = worker->resolveURL(url, es); 63 KURL scriptURL = worker->resolveURL(url, exceptionState);
64 if (scriptURL.isEmpty()) 64 if (scriptURL.isEmpty())
65 return 0; 65 return 0;
66 66
67 // The worker context does not exist while loading, so we must ensure that t he worker object is not collected, nor are its event listeners. 67 // The worker context does not exist while loading, so we must ensure that t he worker object is not collected, nor are its event listeners.
68 worker->setPendingActivity(worker.get()); 68 worker->setPendingActivity(worker.get());
69 69
70 worker->m_scriptLoader = WorkerScriptLoader::create(); 70 worker->m_scriptLoader = WorkerScriptLoader::create();
71 worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOrig inRequests, worker.get()); 71 worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOrig inRequests, worker.get());
72 72
73 return worker.release(); 73 return worker.release();
74 } 74 }
75 75
76 Worker::~Worker() 76 Worker::~Worker()
77 { 77 {
78 ASSERT(isMainThread()); 78 ASSERT(isMainThread());
79 ASSERT(executionContext()); // The context is protected by worker context pr oxy, so it cannot be destroyed while a Worker exists. 79 ASSERT(executionContext()); // The context is protected by worker context pr oxy, so it cannot be destroyed while a Worker exists.
80 m_contextProxy->workerObjectDestroyed(); 80 m_contextProxy->workerObjectDestroyed();
81 } 81 }
82 82
83 const AtomicString& Worker::interfaceName() const 83 const AtomicString& Worker::interfaceName() const
84 { 84 {
85 return EventTargetNames::Worker; 85 return EventTargetNames::Worker;
86 } 86 }
87 87
88 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const Messag ePortArray* ports, ExceptionState& es) 88 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const Messag ePortArray* ports, ExceptionState& exceptionState)
89 { 89 {
90 // Disentangle the port in preparation for sending it to the remote context. 90 // Disentangle the port in preparation for sending it to the remote context.
91 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por ts, es); 91 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por ts, exceptionState);
92 if (es.hadException()) 92 if (exceptionState.hadException())
93 return; 93 return;
94 m_contextProxy->postMessageToWorkerGlobalScope(message, channels.release()); 94 m_contextProxy->postMessageToWorkerGlobalScope(message, channels.release());
95 } 95 }
96 96
97 void Worker::terminate() 97 void Worker::terminate()
98 { 98 {
99 m_contextProxy->terminateWorkerGlobalScope(); 99 m_contextProxy->terminateWorkerGlobalScope();
100 } 100 }
101 101
102 void Worker::stop() 102 void Worker::stop()
(...skipping 21 matching lines...) Expand all
124 startMode = PauseWorkerGlobalScopeOnStart; 124 startMode = PauseWorkerGlobalScopeOnStart;
125 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), executionC ontext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode) ; 125 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), executionC ontext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode) ;
126 InspectorInstrumentation::scriptImported(executionContext(), m_scriptLoa der->identifier(), m_scriptLoader->script()); 126 InspectorInstrumentation::scriptImported(executionContext(), m_scriptLoa der->identifier(), m_scriptLoader->script());
127 } 127 }
128 m_scriptLoader = nullptr; 128 m_scriptLoader = nullptr;
129 129
130 unsetPendingActivity(this); 130 unsetPendingActivity(this);
131 } 131 }
132 132
133 } // namespace WebCore 133 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/SharedWorker.cpp ('k') | Source/core/workers/WorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698