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

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

Issue 1851743002: Simplify Supplementables post Oilpan. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix component build Created 4 years, 8 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr ibuteAwareFormControlUIEnabled); 93 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr ibuteAwareFormControlUIEnabled);
94 settings->setImagesEnabled(m_imagesEnabled); 94 settings->setImagesEnabled(m_imagesEnabled);
95 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL); 95 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL);
96 settings->genericFontFamilySettings().reset(); 96 settings->genericFontFamilySettings().reset();
97 RuntimeEnabledFeatures::setImageColorProfilesEnabled(m_originalImageColorPro filesEnabled); 97 RuntimeEnabledFeatures::setImageColorProfilesEnabled(m_originalImageColorPro filesEnabled);
98 settings->setImageAnimationPolicy(m_originalImageAnimationPolicy); 98 settings->setImageAnimationPolicy(m_originalImageAnimationPolicy);
99 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(m_originalScrollTopLe ftInteropEnabled); 99 RuntimeEnabledFeatures::setScrollTopLeftInteropEnabled(m_originalScrollTopLe ftInteropEnabled);
100 RuntimeEnabledFeatures::setCompositorWorkerEnabled(m_originalCompositorWorke rEnabled); 100 RuntimeEnabledFeatures::setCompositorWorkerEnabled(m_originalCompositorWorke rEnabled);
101 } 101 }
102 102
103 #if ENABLE(OILPAN)
104 InternalSettings* InternalSettings::from(Page& page) 103 InternalSettings* InternalSettings::from(Page& page)
105 { 104 {
106 if (!HeapSupplement<Page>::from(page, supplementName())) 105 if (!HeapSupplement<Page>::from(page, supplementName()))
107 HeapSupplement<Page>::provideTo(page, supplementName(), new InternalSett ings(page)); 106 HeapSupplement<Page>::provideTo(page, supplementName(), new InternalSett ings(page));
108 return static_cast<InternalSettings*>(HeapSupplement<Page>::from(page, suppl ementName())); 107 return static_cast<InternalSettings*>(HeapSupplement<Page>::from(page, suppl ementName()));
109 } 108 }
110 #else
111 // We can't use RefCountedSupplement because that would try to make InternalSett ings RefCounted
112 // and InternalSettings is already RefCounted via its base class, InternalSettin gsGenerated.
113 // Instead, we manually make InternalSettings supplement Page.
114 class InternalSettingsWrapper : public Supplement<Page> {
115 public:
116 explicit InternalSettingsWrapper(Page& page)
117 : m_internalSettings(InternalSettings::create(page)) { }
118 virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); }
119 #if ENABLE(ASSERT)
120 bool isRefCountedWrapper() const override { return true; }
121 #endif
122 InternalSettings* internalSettings() const { return m_internalSettings.get() ; }
123
124 private:
125 RefPtr<InternalSettings> m_internalSettings;
126 };
127
128 InternalSettings* InternalSettings::from(Page& page)
129 {
130 if (!Supplement<Page>::from(page, supplementName()))
131 Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new Interna lSettingsWrapper(page)));
132 return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, su pplementName()))->internalSettings();
133 }
134 #endif
135
136 const char* InternalSettings::supplementName() 109 const char* InternalSettings::supplementName()
137 { 110 {
138 return "InternalSettings"; 111 return "InternalSettings";
139 } 112 }
140 113
141 InternalSettings::~InternalSettings() 114 InternalSettings::~InternalSettings()
142 { 115 {
143 } 116 }
144 117
145 InternalSettings::InternalSettings(Page& page) 118 InternalSettings::InternalSettings(Page& page)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void InternalSettings::setDefaultVideoPosterURL(const String& url, ExceptionStat e& exceptionState) 322 void InternalSettings::setDefaultVideoPosterURL(const String& url, ExceptionStat e& exceptionState)
350 { 323 {
351 InternalSettingsGuardForSettings(); 324 InternalSettingsGuardForSettings();
352 settings()->setDefaultVideoPosterURL(url); 325 settings()->setDefaultVideoPosterURL(url);
353 } 326 }
354 327
355 DEFINE_TRACE(InternalSettings) 328 DEFINE_TRACE(InternalSettings)
356 { 329 {
357 visitor->trace(m_page); 330 visitor->trace(m_page);
358 InternalSettingsGenerated::trace(visitor); 331 InternalSettingsGenerated::trace(visitor);
359 #if ENABLE(OILPAN) 332 Supplement<Page>::trace(visitor);
360 HeapSupplement<Page>::trace(visitor);
361 #endif
362 } 333 }
363 334
364 void InternalSettings::setAvailablePointerTypes(const String& pointers, Exceptio nState& exceptionState) 335 void InternalSettings::setAvailablePointerTypes(const String& pointers, Exceptio nState& exceptionState)
365 { 336 {
366 InternalSettingsGuardForSettings(); 337 InternalSettingsGuardForSettings();
367 338
368 // Allow setting multiple pointer types by passing comma seperated list 339 // Allow setting multiple pointer types by passing comma seperated list
369 // ("coarse,fine"). 340 // ("coarse,fine").
370 Vector<String> tokens; 341 Vector<String> tokens;
371 pointers.split(",", false, tokens); 342 pointers.split(",", false, tokens);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 settings()->setLogPreload(enabled); 475 settings()->setLogPreload(enabled);
505 } 476 }
506 477
507 void InternalSettings::setCompositorWorkerEnabled(bool enabled, ExceptionState& exceptionState) 478 void InternalSettings::setCompositorWorkerEnabled(bool enabled, ExceptionState& exceptionState)
508 { 479 {
509 InternalSettingsGuardForSettings(); 480 InternalSettingsGuardForSettings();
510 RuntimeEnabledFeatures::setCompositorWorkerEnabled(enabled); 481 RuntimeEnabledFeatures::setCompositorWorkerEnabled(enabled);
511 } 482 }
512 483
513 } // namespace blink 484 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.cpp ('k') | third_party/WebKit/Source/core/workers/SharedWorker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698