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

Side by Side Diff: Source/core/html/imports/HTMLImport.h

Issue 211363004: [Refactring] Turn HTMLImport::m_sync from bool to an enum. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed the default parameter Created 6 years, 9 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 | « no previous file | Source/core/html/imports/HTMLImportChild.h » ('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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // 94 //
95 // - An import under loading also blocks imported documents that follow from bei ng created. 95 // - An import under loading also blocks imported documents that follow from bei ng created.
96 // This is because an import can include another import that has same URLs of following ones. 96 // This is because an import can include another import that has same URLs of following ones.
97 // In such case, the preceding import should be loaded and following ones shou ld be de-duped. 97 // In such case, the preceding import should be loaded and following ones shou ld be de-duped.
98 // 98 //
99 99
100 // The superclass of HTMLImportsController and HTMLImportChild 100 // The superclass of HTMLImportsController and HTMLImportChild
101 // This represents the import tree data structure. 101 // This represents the import tree data structure.
102 class HTMLImport : public TreeNode<HTMLImport> { 102 class HTMLImport : public TreeNode<HTMLImport> {
103 public: 103 public:
104 enum SyncMode {
105 Sync = 0,
106 Async = 1
107 };
108
104 static bool isMaster(Document*); 109 static bool isMaster(Document*);
105 110
106 virtual ~HTMLImport() { } 111 virtual ~HTMLImport() { }
107 112
108 LocalFrame* frame(); 113 LocalFrame* frame();
109 Document* master(); 114 Document* master();
110 HTMLImportsController* controller(); 115 HTMLImportsController* controller();
111 bool isRoot() const { return !isChild(); } 116 bool isRoot() const { return !isChild(); }
112 bool isSync() const { return m_sync; } 117 bool isSync() const { return SyncMode(m_sync) == Sync; }
113 const HTMLImportState& state() const { return m_state; } 118 const HTMLImportState& state() const { return m_state; }
114 119
115 void appendChild(HTMLImport*); 120 void appendChild(HTMLImport*);
116 121
117 virtual bool isChild() const { return false; } 122 virtual bool isChild() const { return false; }
118 virtual HTMLImportRoot* root() = 0; 123 virtual HTMLImportRoot* root() = 0;
119 virtual Document* document() const = 0; 124 virtual Document* document() const = 0;
120 virtual void wasDetachedFromDocument() = 0; 125 virtual void wasDetachedFromDocument() = 0;
121 virtual void didFinishParsing() { }; 126 virtual void didFinishParsing() { };
122 virtual void didRemoveAllPendingStylesheet() { } 127 virtual void didRemoveAllPendingStylesheet() { }
123 virtual bool isDone() const = 0; // FIXME: Should be renamed to haveFinished Loading() 128 virtual bool isDone() const = 0; // FIXME: Should be renamed to haveFinished Loading()
124 virtual bool hasLoader() const = 0; 129 virtual bool hasLoader() const = 0;
125 virtual bool ownsLoader() const { return false; } 130 virtual bool ownsLoader() const { return false; }
126 virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const { return 0; } 131 virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const { return 0; }
127 virtual void stateDidChange(); 132 virtual void stateDidChange();
128 133
129 protected: 134 protected:
130 // Stating from most conservative state. 135 // Stating from most conservative state.
131 // It will be corrected through state update flow. 136 // It will be corrected through state update flow.
132 explicit HTMLImport(bool sync = false) 137 explicit HTMLImport(SyncMode sync)
133 : m_sync(sync) 138 : m_sync(sync)
134 { } 139 { }
135 140
136 void stateWillChange(); 141 void stateWillChange();
137 static void recalcTreeState(HTMLImport* root); 142 static void recalcTreeState(HTMLImport* root);
138 143
139 #if !defined(NDEBUG) 144 #if !defined(NDEBUG)
140 void show(); 145 void show();
141 void showTree(HTMLImport* highlight, unsigned depth); 146 void showTree(HTMLImport* highlight, unsigned depth);
142 virtual void showThis(); 147 virtual void showThis();
143 #endif 148 #endif
144 149
145 private: 150 private:
146 HTMLImportState m_state; 151 HTMLImportState m_state;
147 bool m_sync : 1; 152 unsigned m_sync : 1;
148 }; 153 };
149 154
150 // An abstract class to decouple its sublcass HTMLImportsController. 155 // An abstract class to decouple its sublcass HTMLImportsController.
151 class HTMLImportRoot : public HTMLImport { 156 class HTMLImportRoot : public HTMLImport {
152 public: 157 public:
153 HTMLImportRoot() { } 158 HTMLImportRoot() : HTMLImport(Sync) { }
154 159
155 virtual void scheduleRecalcState() = 0; 160 virtual void scheduleRecalcState() = 0;
156 virtual HTMLImportsController* toController() = 0; 161 virtual HTMLImportsController* toController() = 0;
157 virtual HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0) const = 0; 162 virtual HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0) const = 0;
158 }; 163 };
159 164
160 } // namespace WebCore 165 } // namespace WebCore
161 166
162 #endif // HTMLImport_h 167 #endif // HTMLImport_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/imports/HTMLImportChild.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698