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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 1508223005: Client side display item cache flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Try performance 2 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) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 if (firstPaintInvalidationTrackingEnabled()) 328 if (firstPaintInvalidationTrackingEnabled())
329 m_debugInfo.clearAnnotatedInvalidateRects(); 329 m_debugInfo.clearAnnotatedInvalidateRects();
330 incrementPaintCount(); 330 incrementPaintCount();
331 331
332 IntRect newInterestRect; 332 IntRect newInterestRect;
333 if (!interestRect) { 333 if (!interestRect) {
334 newInterestRect = m_client->computeInterestRect(this, m_previousInterest Rect); 334 newInterestRect = m_client->computeInterestRect(this, m_previousInterest Rect);
335 interestRect = &newInterestRect; 335 interestRect = &newInterestRect;
336 } 336 }
337 337
338 if (!getPaintController().subsequenceCachingIsDisabled() 338 if (!m_client->needsRepaint(*this)
339 && !m_client->needsRepaint(*this)
340 && !getPaintController().cacheIsEmpty() 339 && !getPaintController().cacheIsEmpty()
341 && m_previousInterestRect == *interestRect) { 340 && m_previousInterestRect == *interestRect) {
342 ASSERT(!getPaintController().hasInvalidations()); 341 ASSERT(!getPaintController().hasInvalidations());
343 return false; 342 if (!getPaintController().subsequenceCachingIsDisabled())
343 return false;
344 DisplayItemClient::s_cacheStatus = true;
344 } 345 }
345 346
346 GraphicsContext context(getPaintController(), disabledMode); 347 GraphicsContext context(getPaintController(), disabledMode);
347 348
348 #ifndef NDEBUG 349 #ifndef NDEBUG
349 if (contentsOpaque() && s_drawDebugRedFill) { 350 if (contentsOpaque() && s_drawDebugRedFill) {
350 FloatRect rect(FloatPoint(), size()); 351 FloatRect rect(FloatPoint(), size());
351 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) { 352 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) {
352 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect); 353 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect);
353 context.fillRect(rect, SK_ColorRED); 354 context.fillRect(rect, SK_ColorRED);
354 } 355 }
355 } 356 }
356 #endif 357 #endif
357 358
358 m_previousInterestRect = *interestRect; 359 m_previousInterestRect = *interestRect;
359 m_client->paintContents(this, context, m_paintingPhase, *interestRect); 360 m_client->paintContents(this, context, m_paintingPhase, *interestRect);
360 notifyFirstPaintToClient(); 361 notifyFirstPaintToClient();
362 DisplayItemClient::s_cacheStatus = false;
361 return true; 363 return true;
362 } 364 }
363 365
364 void GraphicsLayer::notifyFirstPaintToClient() 366 void GraphicsLayer::notifyFirstPaintToClient()
365 { 367 {
366 if (!m_painted) { 368 if (!m_painted) {
367 DisplayItemList& itemList = m_paintController->newDisplayItemList(); 369 DisplayItemList& itemList = m_paintController->newDisplayItemList();
368 for (DisplayItem& item : itemList) { 370 for (DisplayItem& item : itemList) {
369 DisplayItem::Type type = item.getType(); 371 DisplayItem::Type type = item.getType();
370 if (DisplayItem::isDrawingType(type) && type != DisplayItem::Documen tBackground && type != DisplayItem::DebugRedFill && static_cast<const DrawingDis playItem&>(item).picture()) { 372 if (DisplayItem::isDrawingType(type) && type != DisplayItem::Documen tBackground && type != DisplayItem::DebugRedFill && static_cast<const DrawingDis playItem&>(item).picture()) {
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 if (WebLayer* layer = platformLayer()) 1212 if (WebLayer* layer = platformLayer())
1211 layer->setElementId(id); 1213 layer->setElementId(id);
1212 } 1214 }
1213 1215
1214 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties) 1216 void GraphicsLayer::setCompositorMutableProperties(uint32_t properties)
1215 { 1217 {
1216 if (WebLayer* layer = platformLayer()) 1218 if (WebLayer* layer = platformLayer())
1217 layer->setCompositorMutableProperties(properties); 1219 layer->setCompositorMutableProperties(properties);
1218 } 1220 }
1219 1221
1222 void GraphicsLayer::setCanUseClientCacheStatus(bool b)
1223 {
1224 if (!drawsContent())
1225 return;
1226 getPaintController().setCanUseClientCacheStatus(b);
1227 }
1228
1220 } // namespace blink 1229 } // namespace blink
1221 1230
1222 #ifndef NDEBUG 1231 #ifndef NDEBUG
1223 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) 1232 void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
1224 { 1233 {
1225 if (!layer) { 1234 if (!layer) {
1226 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1235 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1227 return; 1236 return;
1228 } 1237 }
1229 1238
1230 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1239 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1231 fprintf(stderr, "%s\n", output.utf8().data()); 1240 fprintf(stderr, "%s\n", output.utf8().data());
1232 } 1241 }
1233 #endif 1242 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698