| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include <memory> | 28 #include <memory> |
| 29 #include "base/memory/ptr_util.h" | 29 #include "base/memory/ptr_util.h" |
| 30 #include "cc/resources/single_release_callback.h" | 30 #include "cc/resources/single_release_callback.h" |
| 31 #include "cc/resources/texture_mailbox.h" | 31 #include "cc/resources/texture_mailbox.h" |
| 32 #include "gpu/command_buffer/client/gles2_interface.h" | 32 #include "gpu/command_buffer/client/gles2_interface.h" |
| 33 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 33 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 34 #include "platform/Histogram.h" | 34 #include "platform/Histogram.h" |
| 35 #include "platform/RuntimeEnabledFeatures.h" | 35 #include "platform/RuntimeEnabledFeatures.h" |
| 36 #include "platform/WebTaskRunner.h" | 36 #include "platform/WebTaskRunner.h" |
| 37 #include "platform/graphics/CanvasHeuristicParameters.h" |
| 37 #include "platform/graphics/CanvasMetrics.h" | 38 #include "platform/graphics/CanvasMetrics.h" |
| 38 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | |
| 39 #include "platform/graphics/GraphicsLayer.h" | 39 #include "platform/graphics/GraphicsLayer.h" |
| 40 #include "platform/graphics/ImageBuffer.h" | 40 #include "platform/graphics/ImageBuffer.h" |
| 41 #include "platform/graphics/gpu/SharedContextRateLimiter.h" | 41 #include "platform/graphics/gpu/SharedContextRateLimiter.h" |
| 42 #include "platform/graphics/paint/PaintCanvas.h" | 42 #include "platform/graphics/paint/PaintCanvas.h" |
| 43 #include "platform/instrumentation/tracing/TraceEvent.h" | 43 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 44 #include "platform/scheduler/child/web_scheduler.h" | 44 #include "platform/scheduler/child/web_scheduler.h" |
| 45 #include "platform/wtf/PtrUtil.h" | 45 #include "platform/wtf/PtrUtil.h" |
| 46 #include "public/platform/Platform.h" | 46 #include "public/platform/Platform.h" |
| 47 #include "public/platform/WebCompositorSupport.h" | 47 #include "public/platform/WebCompositorSupport.h" |
| 48 #include "public/platform/WebGraphicsContext3DProvider.h" | 48 #include "public/platform/WebGraphicsContext3DProvider.h" |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 return layer_->Layer(); | 1037 return layer_->Layer(); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 void Canvas2DLayerBridge::DidDraw(const FloatRect& rect) { | 1040 void Canvas2DLayerBridge::DidDraw(const FloatRect& rect) { |
| 1041 if (is_deferral_enabled_) { | 1041 if (is_deferral_enabled_) { |
| 1042 have_recorded_draw_commands_ = true; | 1042 have_recorded_draw_commands_ = true; |
| 1043 IntRect pixel_bounds = EnclosingIntRect(rect); | 1043 IntRect pixel_bounds = EnclosingIntRect(rect); |
| 1044 recording_pixel_count_ += pixel_bounds.Width() * pixel_bounds.Height(); | 1044 recording_pixel_count_ += pixel_bounds.Width() * pixel_bounds.Height(); |
| 1045 if (recording_pixel_count_ >= | 1045 if (recording_pixel_count_ >= |
| 1046 (size_.Width() * size_.Height() * | 1046 (size_.Width() * size_.Height() * |
| 1047 ExpensiveCanvasHeuristicParameters::kExpensiveOverdrawThreshold)) { | 1047 CanvasHeuristicParameters::kExpensiveOverdrawThreshold)) { |
| 1048 DisableDeferral(kDisableDeferralReasonExpensiveOverdrawHeuristic); | 1048 DisableDeferral(kDisableDeferralReasonExpensiveOverdrawHeuristic); |
| 1049 } | 1049 } |
| 1050 } | 1050 } |
| 1051 did_draw_since_last_flush_ = true; | 1051 did_draw_since_last_flush_ = true; |
| 1052 did_draw_since_last_gpu_flush_ = true; | 1052 did_draw_since_last_gpu_flush_ = true; |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 void Canvas2DLayerBridge::FinalizeFrame() { | 1055 void Canvas2DLayerBridge::FinalizeFrame() { |
| 1056 TRACE_EVENT0("blink", "Canvas2DLayerBridge::finalizeFrame"); | 1056 TRACE_EVENT0("blink", "Canvas2DLayerBridge::finalizeFrame"); |
| 1057 DCHECK(!destruction_in_progress_); | 1057 DCHECK(!destruction_in_progress_); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 default; | 1128 default; |
| 1129 | 1129 |
| 1130 void Canvas2DLayerBridge::Logger::ReportHibernationEvent( | 1130 void Canvas2DLayerBridge::Logger::ReportHibernationEvent( |
| 1131 HibernationEvent event) { | 1131 HibernationEvent event) { |
| 1132 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram, | 1132 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernation_histogram, |
| 1133 ("Canvas.HibernationEvents", kHibernationEventCount)); | 1133 ("Canvas.HibernationEvents", kHibernationEventCount)); |
| 1134 hibernation_histogram.Count(event); | 1134 hibernation_histogram.Count(event); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 } // namespace blink | 1137 } // namespace blink |
| OLD | NEW |