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

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

Issue 2011783002: Rename OwnPtr::clear() to reset() in platform/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 startRecording(); 123 startRecording();
124 } 124 }
125 125
126 Canvas2DLayerBridge::~Canvas2DLayerBridge() 126 Canvas2DLayerBridge::~Canvas2DLayerBridge()
127 { 127 {
128 ASSERT(m_destructionInProgress); 128 ASSERT(m_destructionInProgress);
129 #if USE_IOSURFACE_FOR_2D_CANVAS 129 #if USE_IOSURFACE_FOR_2D_CANVAS
130 clearCHROMIUMImageCache(); 130 clearCHROMIUMImageCache();
131 #endif // USE_IOSURFACE_FOR_2D_CANVAS 131 #endif // USE_IOSURFACE_FOR_2D_CANVAS
132 132
133 m_layer.clear(); 133 m_layer.reset();
134 ASSERT(m_mailboxes.size() == 0); 134 ASSERT(m_mailboxes.size() == 0);
135 } 135 }
136 136
137 void Canvas2DLayerBridge::startRecording() 137 void Canvas2DLayerBridge::startRecording()
138 { 138 {
139 ASSERT(m_isDeferralEnabled); 139 ASSERT(m_isDeferralEnabled);
140 m_recorder = adoptPtr(new SkPictureRecorder); 140 m_recorder = adoptPtr(new SkPictureRecorder);
141 m_recorder->beginRecording(m_size.width(), m_size.height(), nullptr); 141 m_recorder->beginRecording(m_size.width(), m_size.height(), nullptr);
142 if (m_imageBuffer) { 142 if (m_imageBuffer) {
143 m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas()); 143 m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas());
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 DEFINE_STATIC_LOCAL(EnumerationHistogram, gpuDisabledHistogram, ("Canvas.GPU Accelerated2DCanvasDisableDeferralReason", DisableDeferralReasonCount)); 537 DEFINE_STATIC_LOCAL(EnumerationHistogram, gpuDisabledHistogram, ("Canvas.GPU Accelerated2DCanvasDisableDeferralReason", DisableDeferralReasonCount));
538 gpuDisabledHistogram.count(reason); 538 gpuDisabledHistogram.count(reason);
539 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvas DeferralDisabled); 539 CanvasMetrics::countCanvasContextUsage(CanvasMetrics::GPUAccelerated2DCanvas DeferralDisabled);
540 flushRecordingOnly(); 540 flushRecordingOnly();
541 // Because we will be discarding the recorder, if the flush failed 541 // Because we will be discarding the recorder, if the flush failed
542 // content will be lost -> force m_haveRecordedDrawCommands to false 542 // content will be lost -> force m_haveRecordedDrawCommands to false
543 m_haveRecordedDrawCommands = false; 543 m_haveRecordedDrawCommands = false;
544 544
545 m_isDeferralEnabled = false; 545 m_isDeferralEnabled = false;
546 m_recorder.clear(); 546 m_recorder.reset();
547 // install the current matrix/clip stack onto the immediate canvas 547 // install the current matrix/clip stack onto the immediate canvas
548 SkSurface* surface = getOrCreateSurface(); 548 SkSurface* surface = getOrCreateSurface();
549 if (m_imageBuffer && surface) 549 if (m_imageBuffer && surface)
550 m_imageBuffer->resetCanvas(surface->getCanvas()); 550 m_imageBuffer->resetCanvas(surface->getCanvas());
551 } 551 }
552 552
553 void Canvas2DLayerBridge::setImageBuffer(ImageBuffer* imageBuffer) 553 void Canvas2DLayerBridge::setImageBuffer(ImageBuffer* imageBuffer)
554 { 554 {
555 m_imageBuffer = imageBuffer; 555 m_imageBuffer = imageBuffer;
556 if (m_imageBuffer && m_isDeferralEnabled) { 556 if (m_imageBuffer && m_isDeferralEnabled) {
557 m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas()); 557 m_imageBuffer->resetCanvas(m_recorder->getRecordingCanvas());
558 } 558 }
559 } 559 }
560 560
561 void Canvas2DLayerBridge::beginDestruction() 561 void Canvas2DLayerBridge::beginDestruction()
562 { 562 {
563 if (m_destructionInProgress) 563 if (m_destructionInProgress)
564 return; 564 return;
565 if (isHibernating()) 565 if (isHibernating())
566 m_logger->reportHibernationEvent(HibernationEndedWithTeardown); 566 m_logger->reportHibernationEvent(HibernationEndedWithTeardown);
567 m_hibernationImage.clear(); 567 m_hibernationImage.clear();
568 m_recorder.clear(); 568 m_recorder.reset();
569 m_imageBuffer = nullptr; 569 m_imageBuffer = nullptr;
570 m_destructionInProgress = true; 570 m_destructionInProgress = true;
571 setIsHidden(true); 571 setIsHidden(true);
572 m_surface.clear(); 572 m_surface.clear();
573 573
574 unregisterTaskObserver(); 574 unregisterTaskObserver();
575 575
576 if (m_layer) { 576 if (m_layer) {
577 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); 577 GraphicsLayer::unregisterContentsLayer(m_layer->layer());
578 m_layer->clearTexture(); 578 m_layer->clearTexture();
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 #endif // USE_IOSURFACE_FOR_2D_CANVAS 983 #endif // USE_IOSURFACE_FOR_2D_CANVAS
984 } 984 }
985 985
986 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 986 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
987 { 987 {
988 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); 988 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount));
989 hibernationHistogram.count(event); 989 hibernationHistogram.count(event);
990 } 990 }
991 991
992 } // namespace blink 992 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698