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

Side by Side Diff: Source/core/workers/SharedWorker.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/DedicatedWorkerGlobalScope.cpp ('k') | Source/core/workers/Worker.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Apple 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "platform/weborigin/SecurityOrigin.h" 45 #include "platform/weborigin/SecurityOrigin.h"
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 inline SharedWorker::SharedWorker(ExecutionContext* context) 49 inline SharedWorker::SharedWorker(ExecutionContext* context)
50 : AbstractWorker(context) 50 : AbstractWorker(context)
51 { 51 {
52 ScriptWrappable::init(this); 52 ScriptWrappable::init(this);
53 } 53 }
54 54
55 PassRefPtr<SharedWorker> SharedWorker::create(ExecutionContext* context, const S tring& url, const String& name, ExceptionState& es) 55 PassRefPtr<SharedWorker> SharedWorker::create(ExecutionContext* context, const S tring& url, const String& name, ExceptionState& exceptionState)
56 { 56 {
57 ASSERT(isMainThread()); 57 ASSERT(isMainThread());
58 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); 58 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument());
59 59
60 UseCounter::count(toDocument(context)->domWindow(), UseCounter::SharedWorker Start); 60 UseCounter::count(toDocument(context)->domWindow(), UseCounter::SharedWorker Start);
61 61
62 RefPtr<SharedWorker> worker = adoptRef(new SharedWorker(context)); 62 RefPtr<SharedWorker> worker = adoptRef(new SharedWorker(context));
63 63
64 RefPtr<MessageChannel> channel = MessageChannel::create(context); 64 RefPtr<MessageChannel> channel = MessageChannel::create(context);
65 worker->m_port = channel->port1(); 65 worker->m_port = channel->port1();
66 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(); 66 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle();
67 ASSERT(remotePort); 67 ASSERT(remotePort);
68 68
69 worker->suspendIfNeeded(); 69 worker->suspendIfNeeded();
70 70
71 // We don't currently support nested workers, so workers can only be created from documents. 71 // We don't currently support nested workers, so workers can only be created from documents.
72 Document* document = toDocument(context); 72 Document* document = toDocument(context);
73 if (!document->securityOrigin()->canAccessSharedWorkers()) { 73 if (!document->securityOrigin()->canAccessSharedWorkers()) {
74 es.throwSecurityError("Failed to create 'SharedWorker': access to shared workers is denied to origin '" + document->securityOrigin()->toString() + "'.") ; 74 exceptionState.throwSecurityError("Failed to create 'SharedWorker': acce ss to shared workers is denied to origin '" + document->securityOrigin()->toStri ng() + "'.");
75 return 0; 75 return 0;
76 } 76 }
77 77
78 KURL scriptURL = worker->resolveURL(url, es); 78 KURL scriptURL = worker->resolveURL(url, exceptionState);
79 if (scriptURL.isEmpty()) 79 if (scriptURL.isEmpty())
80 return 0; 80 return 0;
81 81
82 if (document->page() && document->page()->sharedWorkerRepositoryClient()) 82 if (document->page() && document->page()->sharedWorkerRepositoryClient())
83 document->page()->sharedWorkerRepositoryClient()->connect(worker.get(), remotePort.release(), scriptURL, name, es); 83 document->page()->sharedWorkerRepositoryClient()->connect(worker.get(), remotePort.release(), scriptURL, name, exceptionState);
84 84
85 return worker.release(); 85 return worker.release();
86 } 86 }
87 87
88 SharedWorker::~SharedWorker() 88 SharedWorker::~SharedWorker()
89 { 89 {
90 } 90 }
91 91
92 const AtomicString& SharedWorker::interfaceName() const 92 const AtomicString& SharedWorker::interfaceName() const
93 { 93 {
94 return EventTargetNames::SharedWorker; 94 return EventTargetNames::SharedWorker;
95 } 95 }
96 96
97 void SharedWorker::setPreventGC() 97 void SharedWorker::setPreventGC()
98 { 98 {
99 setPendingActivity(this); 99 setPendingActivity(this);
100 } 100 }
101 101
102 void SharedWorker::unsetPreventGC() 102 void SharedWorker::unsetPreventGC()
103 { 103 {
104 unsetPendingActivity(this); 104 unsetPendingActivity(this);
105 } 105 }
106 106
107 } // namespace WebCore 107 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/workers/DedicatedWorkerGlobalScope.cpp ('k') | Source/core/workers/Worker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698