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

Side by Side Diff: Source/core/dom/ContextFeatures.h

Issue 255983003: Oilpan: Move all supplements of Page, Document, and WorkerClients to the managed heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: using namespace WebCore Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/CSSSelectorWatch.cpp ('k') | Source/core/dom/ContextFeatures.cpp » ('j') | 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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 17 matching lines...) Expand all
28 #define ContextFeatures_h 28 #define ContextFeatures_h
29 29
30 #include "platform/RefCountedSupplement.h" 30 #include "platform/RefCountedSupplement.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 class ContextFeaturesClient; 34 class ContextFeaturesClient;
35 class Document; 35 class Document;
36 class Page; 36 class Page;
37 37
38 #if ENABLE(OILPAN)
39 class ContextFeatures FINAL : public RefCountedGarbageCollected<ContextFeatures> , public HeapSupplement<Page> {
40 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ContextFeatures);
41 public:
42 typedef HeapSupplement<Page> SupplementType;
43 #else
38 class ContextFeatures : public RefCountedSupplement<Page, ContextFeatures> { 44 class ContextFeatures : public RefCountedSupplement<Page, ContextFeatures> {
39 public: 45 public:
46 typedef RefCountedSupplement<Page, ContextFeatures> SupplementType;
47 #endif
40 enum FeatureType { 48 enum FeatureType {
41 DialogElement = 0, 49 DialogElement = 0,
42 StyleScoped, 50 StyleScoped,
43 PagePopup, 51 PagePopup,
44 MutationEvents, 52 MutationEvents,
45 PushState, 53 PushState,
46 FeatureTypeSize // Should be the last entry. 54 FeatureTypeSize // Should be the last entry.
47 }; 55 };
48 56
49 static const char* supplementName(); 57 static const char* supplementName();
50 static ContextFeatures* defaultSwitch(); 58 static ContextFeatures* defaultSwitch();
51 static PassRefPtr<ContextFeatures> create(PassOwnPtr<ContextFeaturesClient>) ; 59 static PassRefPtrWillBeRawPtr<ContextFeatures> create(PassOwnPtr<ContextFeat uresClient>);
52 60
53 static bool dialogElementEnabled(Document*); 61 static bool dialogElementEnabled(Document*);
54 static bool styleScopedEnabled(Document*); 62 static bool styleScopedEnabled(Document*);
55 static bool pagePopupEnabled(Document*); 63 static bool pagePopupEnabled(Document*);
56 static bool mutationEventsEnabled(Document*); 64 static bool mutationEventsEnabled(Document*);
57 static bool pushStateEnabled(Document*); 65 static bool pushStateEnabled(Document*);
58 66
59 bool isEnabled(Document*, FeatureType, bool) const; 67 bool isEnabled(Document*, FeatureType, bool) const;
60 void urlDidChange(Document*); 68 void urlDidChange(Document*);
61 69
70 #if ENABLE(OILPAN)
71 virtual void trace(Visitor*) OVERRIDE { }
72 #endif
73
62 private: 74 private:
63 explicit ContextFeatures(PassOwnPtr<ContextFeaturesClient> client) 75 explicit ContextFeatures(PassOwnPtr<ContextFeaturesClient> client)
64 : m_client(client) 76 : m_client(client)
65 { } 77 { }
66 78
67 OwnPtr<ContextFeaturesClient> m_client; 79 OwnPtr<ContextFeaturesClient> m_client;
68 }; 80 };
69 81
70 class ContextFeaturesClient { 82 class ContextFeaturesClient {
71 WTF_MAKE_FAST_ALLOCATED; 83 WTF_MAKE_FAST_ALLOCATED;
72 public: 84 public:
73 static PassOwnPtr<ContextFeaturesClient> empty(); 85 static PassOwnPtr<ContextFeaturesClient> empty();
74 86
75 virtual ~ContextFeaturesClient() { } 87 virtual ~ContextFeaturesClient() { }
76 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool default Value) { return defaultValue; } 88 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool default Value) { return defaultValue; }
77 virtual void urlDidChange(Document*) { } 89 virtual void urlDidChange(Document*) { }
78 }; 90 };
79 91
80 void provideContextFeaturesTo(Page&, PassOwnPtr<ContextFeaturesClient>); 92 void provideContextFeaturesTo(Page&, PassOwnPtr<ContextFeaturesClient>);
81 void provideContextFeaturesToDocumentFrom(Document&, Page&); 93 void provideContextFeaturesToDocumentFrom(Document&, Page&);
82 94
83 inline PassRefPtr<ContextFeatures> ContextFeatures::create(PassOwnPtr<ContextFea turesClient> client) 95 inline PassRefPtrWillBeRawPtr<ContextFeatures> ContextFeatures::create(PassOwnPt r<ContextFeaturesClient> client)
84 { 96 {
85 return adoptRef(new ContextFeatures(client)); 97 return adoptRefWillBeRefCountedGarbageCollected(new ContextFeatures(client)) ;
86 } 98 }
87 99
88 inline bool ContextFeatures::isEnabled(Document* document, FeatureType type, boo l defaultValue) const 100 inline bool ContextFeatures::isEnabled(Document* document, FeatureType type, boo l defaultValue) const
89 { 101 {
90 if (!m_client) 102 if (!m_client)
91 return defaultValue; 103 return defaultValue;
92 return m_client->isEnabled(document, type, defaultValue); 104 return m_client->isEnabled(document, type, defaultValue);
93 } 105 }
94 106
95 inline void ContextFeatures::urlDidChange(Document* document) 107 inline void ContextFeatures::urlDidChange(Document* document)
96 { 108 {
97 // FIXME: The original code, commented out below, is obviously 109 // FIXME: The original code, commented out below, is obviously
98 // wrong, but the seemingly correct fix of negating the test to 110 // wrong, but the seemingly correct fix of negating the test to
99 // the more logical 'if (!m_client)' crashes the renderer. 111 // the more logical 'if (!m_client)' crashes the renderer.
100 // See issue 294180 112 // See issue 294180
101 // 113 //
102 // if (m_client) 114 // if (m_client)
103 // return; 115 // return;
104 // m_client->urlDidChange(document); 116 // m_client->urlDidChange(document);
105 } 117 }
106 118
107 } // namespace WebCore 119 } // namespace WebCore
108 120
109 #endif // ContextFeatures_h 121 #endif // ContextFeatures_h
OLDNEW
« no previous file with comments | « Source/core/dom/CSSSelectorWatch.cpp ('k') | Source/core/dom/ContextFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698