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

Side by Side Diff: Source/platform/graphics/paint/DisplayItem.h

Issue 1160763005: Don't cache reflection drawings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DisplayItem_h 5 #ifndef DisplayItem_h
6 #define DisplayItem_h 6 #define DisplayItem_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/paint/DisplayItemClient.h" 9 #include "platform/graphics/paint/DisplayItemClient.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax, 173 EndSubtreePaintPhaseLast = EndSubtreePaintPhaseFirst + PaintPhaseMax,
174 EndSubtreeLast = EndSubtreePaintPhaseLast, 174 EndSubtreeLast = EndSubtreePaintPhaseLast,
175 175
176 TypeLast = EndSubtreeLast 176 TypeLast = EndSubtreeLast
177 }; 177 };
178 178
179 virtual ~DisplayItem() { } 179 virtual ~DisplayItem() { }
180 180
181 virtual void replay(GraphicsContext&) { } 181 virtual void replay(GraphicsContext&) { }
182 182
183 DisplayItemClient client() const { return m_id.client; } 183 DisplayItemClient client() const { return m_client; }
184 Type type() const { return m_id.type; } 184 Type type() const { return m_type; }
185 bool idsEqual(const DisplayItem& other, Type overrideType) const 185 bool idsEqual(const DisplayItem& other, Type overrideType) const
186 { 186 {
187 return m_id.client == other.m_id.client 187 return m_client == other.m_client
188 && m_id.type == overrideType 188 && m_type == overrideType
189 && m_id.scopeId == other.m_id.scopeId 189 && m_scopeId == other.m_scopeId
190 && m_id.scopeContainer == other.m_id.scopeContainer; 190 && m_scopeContainer == other.m_scopeContainer;
191 } 191 }
192 192
193 void setScope(int scopeId, DisplayItemClient scopeContainer) 193 void setScope(int scopeId, DisplayItemClient scopeContainer)
194 { 194 {
195 m_id.scopeId = scopeId; 195 m_scopeId = scopeId;
196 m_id.scopeContainer = scopeContainer; 196 m_scopeContainer = scopeContainer;
197 } 197 }
198 198
199 void setSkippedCache() { m_skippedCache = true; }
200 bool skippedCache() const { return m_skippedCache; }
201
199 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { } 202 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const { }
200 203
201 // See comments of enum Type for usage of the following macros. 204 // See comments of enum Type for usage of the following macros.
202 #define DEFINE_CATEGORY_METHODS(Category) \ 205 #define DEFINE_CATEGORY_METHODS(Category) \
203 static bool is##Category##Type(Type type) { return type >= Category##First & & type <= Category##Last; } \ 206 static bool is##Category##Type(Type type) { return type >= Category##First & & type <= Category##Last; } \
204 bool is##Category() const { return is##Category##Type(type()); } 207 bool is##Category() const { return is##Category##Type(type()); }
205 208
206 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ 209 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \
207 static Type category1##TypeTo##Category2##Type(Type type) \ 210 static Type category1##TypeTo##Category2##Type(Type type) \
208 { \ 211 { \
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 272
270 #ifndef NDEBUG 273 #ifndef NDEBUG
271 static WTF::String typeAsDebugString(DisplayItem::Type); 274 static WTF::String typeAsDebugString(DisplayItem::Type);
272 const WTF::String& clientDebugString() const { return m_clientDebugString; } 275 const WTF::String& clientDebugString() const { return m_clientDebugString; }
273 WTF::String asDebugString() const; 276 WTF::String asDebugString() const;
274 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const; 277 virtual void dumpPropertiesAsDebugString(WTF::StringBuilder&) const;
275 #endif 278 #endif
276 279
277 protected: 280 protected:
278 DisplayItem(const DisplayItemClientWrapper& client, Type type) 281 DisplayItem(const DisplayItemClientWrapper& client, Type type)
279 : m_id(client.displayItemClient(), type) 282 : m_client(client.displayItemClient())
283 , m_scopeContainer(nullptr)
284 , m_scopeId(0)
285 , m_type(type)
286 , m_skippedCache(false)
280 #ifndef NDEBUG 287 #ifndef NDEBUG
281 , m_clientDebugString(client.debugName()) 288 , m_clientDebugString(client.debugName())
282 #endif 289 #endif
283 { } 290 { }
284 291
285 private: 292 private:
286 struct Id { 293 const DisplayItemClient m_client;
chrishtr 2015/06/02 17:06:56 What's the point of flattening the struct? Is it n
Xianzhu 2015/06/02 17:36:34 Otherwise it would be: struct Id { ... };
287 Id(DisplayItemClient c, Type t) : client(c), type(t), scopeId(0), scopeC ontainer(nullptr) 294 DisplayItemClient m_scopeContainer;
288 { 295 unsigned m_scopeId : 16;
pdr. 2015/06/02 17:16:08 This seems dangerous in the future and doesn't do
Xianzhu 2015/06/02 17:36:35 Restored back to 'int'.
289 ASSERT(c); 296 const Type m_type : 15;
290 } 297 bool m_skippedCache : 1;
291
292 const DisplayItemClient client;
293 const Type type;
294 int scopeId;
295 DisplayItemClient scopeContainer;
296 } m_id;
297 298
298 #ifndef NDEBUG 299 #ifndef NDEBUG
299 WTF::String m_clientDebugString; 300 WTF::String m_clientDebugString;
300 #endif 301 #endif
301 }; 302 };
302 303
303 class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem { 304 class PLATFORM_EXPORT PairedBeginDisplayItem : public DisplayItem {
304 protected: 305 protected:
305 PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { } 306 PairedBeginDisplayItem(const DisplayItemClientWrapper& client, Type type) : DisplayItem(client, type) { }
306 307
307 private: 308 private:
308 virtual bool isBegin() const override final { return true; } 309 virtual bool isBegin() const override final { return true; }
309 }; 310 };
310 311
311 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem { 312 class PLATFORM_EXPORT PairedEndDisplayItem : public DisplayItem {
312 protected: 313 protected:
313 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di splayItem(client, type) { } 314 PairedEndDisplayItem(const DisplayItemClientWrapper& client, Type type) : Di splayItem(client, type) { }
314 315
315 #if ENABLE(ASSERT) 316 #if ENABLE(ASSERT)
316 virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0 ; 317 virtual bool isEndAndPairedWith(const DisplayItem& other) const override = 0 ;
317 #endif 318 #endif
318 319
319 private: 320 private:
320 virtual bool isEnd() const override final { return true; } 321 virtual bool isEnd() const override final { return true; }
321 }; 322 };
322 323
323 } // namespace blink 324 } // namespace blink
324 325
325 #endif // DisplayItem_h 326 #endif // DisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698