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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceObserver.cpp

Issue 2468063006: Updated error message in PerformanceObserver.observe (Closed)
Patch Set: resolved comments Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/timing/PerformanceObserver.h" 5 #include "core/timing/PerformanceObserver.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/PerformanceObserverCallback.h" 8 #include "bindings/core/v8/PerformanceObserverCallback.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/timing/PerformanceBase.h" 10 #include "core/timing/PerformanceBase.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 PerformanceEntryTypeMask entryTypes = PerformanceEntry::Invalid; 44 PerformanceEntryTypeMask entryTypes = PerformanceEntry::Invalid;
45 if (observerInit.hasEntryTypes() && observerInit.entryTypes().size()) { 45 if (observerInit.hasEntryTypes() && observerInit.entryTypes().size()) {
46 const Vector<String>& sequence = observerInit.entryTypes(); 46 const Vector<String>& sequence = observerInit.entryTypes();
47 for (const auto& entryTypeString : sequence) 47 for (const auto& entryTypeString : sequence)
48 entryTypes |= PerformanceEntry::toEntryTypeEnum(entryTypeString); 48 entryTypes |= PerformanceEntry::toEntryTypeEnum(entryTypeString);
49 } 49 }
50 if (entryTypes == PerformanceEntry::Invalid) { 50 if (entryTypes == PerformanceEntry::Invalid) {
51 exceptionState.throwTypeError( 51 exceptionState.throwTypeError(
52 "A Performance Observer MUST have a non-empty entryTypes attribute."); 52 "A Performance Observer MUST have at least one valid entryType in its "
53 "entryTypes attribute.");
53 return; 54 return;
54 } 55 }
55 m_filterOptions = entryTypes; 56 m_filterOptions = entryTypes;
56 if (m_isRegistered) 57 if (m_isRegistered)
57 m_performance->updatePerformanceObserverFilterOptions(); 58 m_performance->updatePerformanceObserverFilterOptions();
58 else 59 else
59 m_performance->registerPerformanceObserver(*this); 60 m_performance->registerPerformanceObserver(*this);
60 m_isRegistered = true; 61 m_isRegistered = true;
61 } 62 }
62 63
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 visitor->trace(m_callback); 98 visitor->trace(m_callback);
98 visitor->trace(m_performance); 99 visitor->trace(m_performance);
99 visitor->trace(m_performanceEntries); 100 visitor->trace(m_performanceEntries);
100 } 101 }
101 102
102 DEFINE_TRACE_WRAPPERS(PerformanceObserver) { 103 DEFINE_TRACE_WRAPPERS(PerformanceObserver) {
103 visitor->traceWrappers(m_callback); 104 visitor->traceWrappers(m_callback);
104 } 105 }
105 106
106 } // namespace blink 107 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698