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

Side by Side Diff: third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp

Issue 2586863002: Worker: Enable UseCounter for SharedWorkerGlobalScope (Closed)
Patch Set: replace ExecutionContext with ScriptState Created 3 years, 10 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 "web/SharedWorkerRepositoryClientImpl.h" 31 #include "web/SharedWorkerRepositoryClientImpl.h"
32 32
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/events/Event.h" 34 #include "core/events/Event.h"
35 #include "core/frame/Deprecation.h"
35 #include "core/frame/UseCounter.h" 36 #include "core/frame/UseCounter.h"
36 #include "core/frame/csp/ContentSecurityPolicy.h" 37 #include "core/frame/csp/ContentSecurityPolicy.h"
37 #include "core/inspector/InspectorInstrumentation.h" 38 #include "core/inspector/InspectorInstrumentation.h"
38 #include "core/workers/SharedWorker.h" 39 #include "core/workers/SharedWorker.h"
39 #include "platform/network/ResourceResponse.h" 40 #include "platform/network/ResourceResponse.h"
40 #include "public/platform/WebMessagePortChannel.h" 41 #include "public/platform/WebMessagePortChannel.h"
41 #include "public/platform/WebString.h" 42 #include "public/platform/WebString.h"
42 #include "public/platform/WebURL.h" 43 #include "public/platform/WebURL.h"
43 #include "public/web/WebContentSecurityPolicy.h" 44 #include "public/web/WebContentSecurityPolicy.h"
44 #include "public/web/WebFrameClient.h" 45 #include "public/web/WebFrameClient.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 90 }
90 } 91 }
91 92
92 void scriptLoadFailed() override { 93 void scriptLoadFailed() override {
93 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error)); 94 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error));
94 m_worker->setIsBeingConnected(false); 95 m_worker->setIsBeingConnected(false);
95 } 96 }
96 97
97 void connected() override { m_worker->setIsBeingConnected(false); } 98 void connected() override { m_worker->setIsBeingConnected(false); }
98 99
100 void countFeature(uint32_t feature) override {
101 static_assert(UseCounter::NumberOfFeatures < UINT32_MAX,
102 "uint32_t must be larger than number of features");
103 UseCounter::Feature useCounterFeature =
104 static_cast<UseCounter::Feature>(feature);
105 if (Deprecation::deprecationMessage(useCounterFeature).isEmpty()) {
106 UseCounter::count(m_worker->getExecutionContext(), useCounterFeature);
107 } else {
108 Deprecation::countDeprecation(m_worker->getExecutionContext(),
109 useCounterFeature);
110 }
111 }
112
99 Persistent<SharedWorker> m_worker; 113 Persistent<SharedWorker> m_worker;
100 }; 114 };
101 115
102 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) { 116 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) {
103 DCHECK(document); 117 DCHECK(document);
104 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>( 118 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(
105 document); 119 document);
106 } 120 }
107 121
108 void SharedWorkerRepositoryClientImpl::connect( 122 void SharedWorkerRepositoryClientImpl::connect(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) { 160 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) {
147 DCHECK(m_client); 161 DCHECK(m_client);
148 m_client->documentDetached(getId(document)); 162 m_client->documentDetached(getId(document));
149 } 163 }
150 164
151 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl( 165 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(
152 WebSharedWorkerRepositoryClient* client) 166 WebSharedWorkerRepositoryClient* client)
153 : m_client(client) {} 167 : m_client(client) {}
154 168
155 } // namespace blink 169 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698