| OLD | NEW |
| 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 Loading... |
| 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 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3201 resolver->Resolve(); | 3200 resolver->Resolve(); |
| 3202 return promise; | 3201 return promise; |
| 3203 } | 3202 } |
| 3204 | 3203 |
| 3205 Page* page = document->GetPage(); | 3204 Page* page = document->GetPage(); |
| 3206 if (!page) { | 3205 if (!page) { |
| 3207 resolver->Reject(); | 3206 resolver->Reject(); |
| 3208 return promise; | 3207 return promise; |
| 3209 } | 3208 } |
| 3210 | 3209 |
| 3211 page->GetUseCounter().AddObserver( | 3210 page->GetUseCounter().AddObserver(new UseCounterObserverImpl( |
| 3212 new UseCounterObserverImpl(resolver, use_counter_feature)); | 3211 resolver, static_cast<WebFeature>(use_counter_feature))); |
| 3213 return promise; | 3212 return promise; |
| 3214 } | 3213 } |
| 3215 | 3214 |
| 3216 String Internals::unscopableAttribute() { | 3215 String Internals::unscopableAttribute() { |
| 3217 return "unscopableAttribute"; | 3216 return "unscopableAttribute"; |
| 3218 } | 3217 } |
| 3219 | 3218 |
| 3220 String Internals::unscopableMethod() { | 3219 String Internals::unscopableMethod() { |
| 3221 return "unscopableMethod"; | 3220 return "unscopableMethod"; |
| 3222 } | 3221 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3281 | 3280 |
| 3282 void Internals::crash() { | 3281 void Internals::crash() { |
| 3283 CHECK(false) << "Intentional crash"; | 3282 CHECK(false) << "Intentional crash"; |
| 3284 } | 3283 } |
| 3285 | 3284 |
| 3286 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3285 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3287 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3286 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3288 } | 3287 } |
| 3289 | 3288 |
| 3290 } // namespace blink | 3289 } // namespace blink |
| OLD | NEW |