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

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

Issue 2586863002: Worker: Enable UseCounter for SharedWorkerGlobalScope (Closed)
Patch Set: address review comments 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 } 90 }
91 91
92 void scriptLoadFailed() override { 92 void scriptLoadFailed() override {
93 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error)); 93 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error));
94 m_worker->setIsBeingConnected(false); 94 m_worker->setIsBeingConnected(false);
95 } 95 }
96 96
97 void connected() override { m_worker->setIsBeingConnected(false); } 97 void connected() override { m_worker->setIsBeingConnected(false); }
98 98
99 void countFeature(uint32_t feature) override {
100 static_assert(UseCounter::NumberOfFeatures < UINT32_MAX,
101 "uint32_t must be larger than number of features");
102 UseCounter::count(m_worker->getExecutionContext(),
103 static_cast<UseCounter::Feature>(feature));
104 }
105
99 Persistent<SharedWorker> m_worker; 106 Persistent<SharedWorker> m_worker;
100 }; 107 };
101 108
102 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) { 109 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) {
103 DCHECK(document); 110 DCHECK(document);
104 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>( 111 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(
105 document); 112 document);
106 } 113 }
107 114
108 void SharedWorkerRepositoryClientImpl::connect( 115 void SharedWorkerRepositoryClientImpl::connect(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) { 153 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) {
147 DCHECK(m_client); 154 DCHECK(m_client);
148 m_client->documentDetached(getId(document)); 155 m_client->documentDetached(getId(document));
149 } 156 }
150 157
151 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl( 158 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(
152 WebSharedWorkerRepositoryClient* client) 159 WebSharedWorkerRepositoryClient* client)
153 : m_client(client) {} 160 : m_client(client) {}
154 161
155 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698