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

Side by Side Diff: Source/web/ContextFeaturesClientImpl.cpp

Issue 1060813005: Componentization: fix SupplementTracing<0>::~SupplementTracing<0>(void) already defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #include "web/ContextFeaturesClientImpl.h" 32 #include "web/ContextFeaturesClientImpl.h"
33 33
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "platform/weborigin/SecurityOrigin.h" 35 #include "platform/weborigin/SecurityOrigin.h"
36 #include "public/web/WebContentSettingsClient.h" 36 #include "public/web/WebContentSettingsClient.h"
37 #include "public/web/WebDocument.h" 37 #include "public/web/WebDocument.h"
38 #include "web/WebLocalFrameImpl.h" 38 #include "web/WebLocalFrameImpl.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class ContextFeaturesCache final : public NoBaseWillBeGarbageCollectedFinalized< ContextFeaturesCache>, public DocumentSupplement { 42 class ContextFeaturesCache final : public NoBaseWillBeGarbageCollectedFinalized< ContextFeaturesCache>, public WillBeHeapSupplement<Document> {
43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ContextFeaturesCache); 43 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ContextFeaturesCache);
44 public: 44 public:
45 class Entry { 45 class Entry {
46 public: 46 public:
47 enum Value { 47 enum Value {
48 IsEnabled, 48 IsEnabled,
49 IsDisabled, 49 IsDisabled,
50 NeedsRefresh 50 NeedsRefresh
51 }; 51 };
52 52
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 { 84 {
85 size_t index = static_cast<size_t>(type); 85 size_t index = static_cast<size_t>(type);
86 ASSERT_WITH_SECURITY_IMPLICATION(index < ContextFeatures::FeatureTypeSiz e); 86 ASSERT_WITH_SECURITY_IMPLICATION(index < ContextFeatures::FeatureTypeSiz e);
87 return m_entries[index]; 87 return m_entries[index];
88 } 88 }
89 89
90 void validateAgainst(Document*); 90 void validateAgainst(Document*);
91 91
92 DEFINE_INLINE_VIRTUAL_TRACE() 92 DEFINE_INLINE_VIRTUAL_TRACE()
93 { 93 {
94 DocumentSupplement::trace(visitor); 94 WillBeHeapSupplement<Document>::trace(visitor);
95 } 95 }
96 96
97 private: 97 private:
98 String m_domain; 98 String m_domain;
99 Entry m_entries[ContextFeatures::FeatureTypeSize]; 99 Entry m_entries[ContextFeatures::FeatureTypeSize];
100 }; 100 };
101 101
102 const char* ContextFeaturesCache::supplementName() 102 const char* ContextFeaturesCache::supplementName()
103 { 103 {
104 return "ContextFeaturesCache"; 104 return "ContextFeaturesCache";
105 } 105 }
106 106
107 ContextFeaturesCache& ContextFeaturesCache::from(Document& document) 107 ContextFeaturesCache& ContextFeaturesCache::from(Document& document)
108 { 108 {
109 ContextFeaturesCache* cache = static_cast<ContextFeaturesCache*>(DocumentSup plement::from(document, supplementName())); 109 ContextFeaturesCache* cache = static_cast<ContextFeaturesCache*>(WillBeHeapS upplement<Document>::from(document, supplementName()));
110 if (!cache) { 110 if (!cache) {
111 cache = new ContextFeaturesCache(); 111 cache = new ContextFeaturesCache();
112 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe Noop(cache)); 112 WillBeHeapSupplement<Document>::provideTo(document, supplementName(), ad optPtrWillBeNoop(cache));
113 } 113 }
114 114
115 return *cache; 115 return *cache;
116 } 116 }
117 117
118 void ContextFeaturesCache::validateAgainst(Document* document) 118 void ContextFeaturesCache::validateAgainst(Document* document)
119 { 119 {
120 String currentDomain = document->securityOrigin()->domain(); 120 String currentDomain = document->securityOrigin()->domain();
121 if (currentDomain == m_domain) 121 if (currentDomain == m_domain)
122 return; 122 return;
(...skipping 25 matching lines...) Expand all
148 148
149 switch (type) { 149 switch (type) {
150 case ContextFeatures::MutationEvents: 150 case ContextFeatures::MutationEvents:
151 return frame->contentSettingsClient()->allowMutationEvents(defaultValue) ; 151 return frame->contentSettingsClient()->allowMutationEvents(defaultValue) ;
152 default: 152 default:
153 return defaultValue; 153 return defaultValue;
154 } 154 }
155 } 155 }
156 156
157 } // namespace blink 157 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698