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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2894063002: Expose UseCounter::Feature enum out of blink as WebFeature (Closed)
Patch Set: Rebase Created 3 years, 6 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 #include "v8/include/v8.h" 157 #include "v8/include/v8.h"
158 158
159 namespace blink { 159 namespace blink {
160 160
161 namespace { 161 namespace {
162 162
163 class UseCounterObserverImpl final : public UseCounter::Observer { 163 class UseCounterObserverImpl final : public UseCounter::Observer {
164 WTF_MAKE_NONCOPYABLE(UseCounterObserverImpl); 164 WTF_MAKE_NONCOPYABLE(UseCounterObserverImpl);
165 165
166 public: 166 public:
167 UseCounterObserverImpl(ScriptPromiseResolver* resolver, 167 UseCounterObserverImpl(ScriptPromiseResolver* resolver, WebFeature feature)
168 UseCounter::Feature feature)
169 : resolver_(resolver), feature_(feature) {} 168 : resolver_(resolver), feature_(feature) {}
170 169
171 bool OnCountFeature(UseCounter::Feature feature) final { 170 bool OnCountFeature(WebFeature feature) final {
172 if (feature_ != feature) 171 if (feature_ != feature)
173 return false; 172 return false;
174 resolver_->Resolve(feature); 173 resolver_->Resolve(static_cast<int>(feature));
175 return true; 174 return true;
176 } 175 }
177 176
178 DEFINE_INLINE_VIRTUAL_TRACE() { 177 DEFINE_INLINE_VIRTUAL_TRACE() {
179 UseCounter::Observer::Trace(visitor); 178 UseCounter::Observer::Trace(visitor);
180 visitor->Trace(resolver_); 179 visitor->Trace(resolver_);
181 } 180 }
182 181
183 private: 182 private:
184 Member<ScriptPromiseResolver> resolver_; 183 Member<ScriptPromiseResolver> resolver_;
185 UseCounter::Feature feature_; 184 WebFeature feature_;
186 }; 185 };
187 186
188 } // namespace 187 } // namespace
189 188
190 static WTF::Optional<DocumentMarker::MarkerType> MarkerTypeFrom( 189 static WTF::Optional<DocumentMarker::MarkerType> MarkerTypeFrom(
191 const String& marker_type) { 190 const String& marker_type) {
192 if (DeprecatedEqualIgnoringCase(marker_type, "Spelling")) 191 if (DeprecatedEqualIgnoringCase(marker_type, "Spelling"))
193 return DocumentMarker::kSpelling; 192 return DocumentMarker::kSpelling;
194 if (DeprecatedEqualIgnoringCase(marker_type, "Grammar")) 193 if (DeprecatedEqualIgnoringCase(marker_type, "Grammar"))
195 return DocumentMarker::kGrammar; 194 return DocumentMarker::kGrammar;
(...skipping 3017 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 resolver->Resolve(); 3212 resolver->Resolve();
3214 return promise; 3213 return promise;
3215 } 3214 }
3216 3215
3217 Page* page = document->GetPage(); 3216 Page* page = document->GetPage();
3218 if (!page) { 3217 if (!page) {
3219 resolver->Reject(); 3218 resolver->Reject();
3220 return promise; 3219 return promise;
3221 } 3220 }
3222 3221
3223 page->GetUseCounter().AddObserver( 3222 page->GetUseCounter().AddObserver(new UseCounterObserverImpl(
3224 new UseCounterObserverImpl(resolver, use_counter_feature)); 3223 resolver, static_cast<WebFeature>(use_counter_feature)));
3225 return promise; 3224 return promise;
3226 } 3225 }
3227 3226
3228 String Internals::unscopableAttribute() { 3227 String Internals::unscopableAttribute() {
3229 return "unscopableAttribute"; 3228 return "unscopableAttribute";
3230 } 3229 }
3231 3230
3232 String Internals::unscopableMethod() { 3231 String Internals::unscopableMethod() {
3233 return "unscopableMethod"; 3232 return "unscopableMethod";
3234 } 3233 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 3292
3294 void Internals::crash() { 3293 void Internals::crash() {
3295 CHECK(false) << "Intentional crash"; 3294 CHECK(false) << "Intentional crash";
3296 } 3295 }
3297 3296
3298 void Internals::setIsLowEndDevice(bool is_low_end_device) { 3297 void Internals::setIsLowEndDevice(bool is_low_end_device) {
3299 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); 3298 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device);
3300 } 3299 }
3301 3300
3302 } // namespace blink 3301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698