| 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 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3210 resolver->Resolve(); | 3209 resolver->Resolve(); |
| 3211 return promise; | 3210 return promise; |
| 3212 } | 3211 } |
| 3213 | 3212 |
| 3214 Page* page = document->GetPage(); | 3213 Page* page = document->GetPage(); |
| 3215 if (!page) { | 3214 if (!page) { |
| 3216 resolver->Reject(); | 3215 resolver->Reject(); |
| 3217 return promise; | 3216 return promise; |
| 3218 } | 3217 } |
| 3219 | 3218 |
| 3220 page->GetUseCounter().AddObserver( | 3219 page->GetUseCounter().AddObserver(new UseCounterObserverImpl( |
| 3221 new UseCounterObserverImpl(resolver, use_counter_feature)); | 3220 resolver, static_cast<WebFeature>(use_counter_feature))); |
| 3222 return promise; | 3221 return promise; |
| 3223 } | 3222 } |
| 3224 | 3223 |
| 3225 String Internals::unscopableAttribute() { | 3224 String Internals::unscopableAttribute() { |
| 3226 return "unscopableAttribute"; | 3225 return "unscopableAttribute"; |
| 3227 } | 3226 } |
| 3228 | 3227 |
| 3229 String Internals::unscopableMethod() { | 3228 String Internals::unscopableMethod() { |
| 3230 return "unscopableMethod"; | 3229 return "unscopableMethod"; |
| 3231 } | 3230 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3290 | 3289 |
| 3291 void Internals::crash() { | 3290 void Internals::crash() { |
| 3292 CHECK(false) << "Intentional crash"; | 3291 CHECK(false) << "Intentional crash"; |
| 3293 } | 3292 } |
| 3294 | 3293 |
| 3295 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3294 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3296 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3295 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3297 } | 3296 } |
| 3298 | 3297 |
| 3299 } // namespace blink | 3298 } // namespace blink |
| OLD | NEW |