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

Side by Side Diff: cc/playback/raster_source.cc

Issue 1997913002: Revert "Dump DisplayListRasterSource memory" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « cc/playback/raster_source.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "cc/playback/raster_source.h" 5 #include "cc/playback/raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/stringprintf.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "base/trace_event/memory_dump_manager.h"
12 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
13 #include "cc/base/region.h" 10 #include "cc/base/region.h"
14 #include "cc/debug/debug_colors.h" 11 #include "cc/debug/debug_colors.h"
15 #include "cc/playback/display_item_list.h" 12 #include "cc/playback/display_item_list.h"
16 #include "cc/playback/image_hijack_canvas.h" 13 #include "cc/playback/image_hijack_canvas.h"
17 #include "cc/playback/skip_image_canvas.h" 14 #include "cc/playback/skip_image_canvas.h"
18 #include "skia/ext/analysis_canvas.h" 15 #include "skia/ext/analysis_canvas.h"
19 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
20 #include "third_party/skia/include/core/SkPictureRecorder.h" 17 #include "third_party/skia/include/core/SkPictureRecorder.h"
21 #include "third_party/skia/include/core/SkTLazy.h" 18 #include "third_party/skia/include/core/SkTLazy.h"
(...skipping 15 matching lines...) Expand all
37 can_use_lcd_text_(can_use_lcd_text), 34 can_use_lcd_text_(can_use_lcd_text),
38 is_solid_color_(other->is_solid_color_), 35 is_solid_color_(other->is_solid_color_),
39 solid_color_(other->solid_color_), 36 solid_color_(other->solid_color_),
40 recorded_viewport_(other->recorded_viewport_), 37 recorded_viewport_(other->recorded_viewport_),
41 size_(other->size_), 38 size_(other->size_),
42 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), 39 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_),
43 slow_down_raster_scale_factor_for_debug_( 40 slow_down_raster_scale_factor_for_debug_(
44 other->slow_down_raster_scale_factor_for_debug_), 41 other->slow_down_raster_scale_factor_for_debug_),
45 should_attempt_to_use_distance_field_text_(false), 42 should_attempt_to_use_distance_field_text_(false),
46 image_decode_controller_(nullptr) { 43 image_decode_controller_(nullptr) {
47 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
48 // Don't register a dump provider in these cases.
49 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
50 if (base::ThreadTaskRunnerHandle::IsSet()) {
51 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
52 this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get());
53 }
54 } 44 }
55 45
56 RasterSource::RasterSource(const RasterSource* other, bool can_use_lcd_text) 46 RasterSource::RasterSource(const RasterSource* other, bool can_use_lcd_text)
57 : display_list_(other->display_list_), 47 : display_list_(other->display_list_),
58 painter_reported_memory_usage_(other->painter_reported_memory_usage_), 48 painter_reported_memory_usage_(other->painter_reported_memory_usage_),
59 background_color_(other->background_color_), 49 background_color_(other->background_color_),
60 requires_clear_(other->requires_clear_), 50 requires_clear_(other->requires_clear_),
61 can_use_lcd_text_(can_use_lcd_text), 51 can_use_lcd_text_(can_use_lcd_text),
62 is_solid_color_(other->is_solid_color_), 52 is_solid_color_(other->is_solid_color_),
63 solid_color_(other->solid_color_), 53 solid_color_(other->solid_color_),
64 recorded_viewport_(other->recorded_viewport_), 54 recorded_viewport_(other->recorded_viewport_),
65 size_(other->size_), 55 size_(other->size_),
66 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_), 56 clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_),
67 slow_down_raster_scale_factor_for_debug_( 57 slow_down_raster_scale_factor_for_debug_(
68 other->slow_down_raster_scale_factor_for_debug_), 58 other->slow_down_raster_scale_factor_for_debug_),
69 should_attempt_to_use_distance_field_text_( 59 should_attempt_to_use_distance_field_text_(
70 other->should_attempt_to_use_distance_field_text_), 60 other->should_attempt_to_use_distance_field_text_),
71 image_decode_controller_(other->image_decode_controller_) { 61 image_decode_controller_(other->image_decode_controller_) {
72 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
73 // Don't register a dump provider in these cases.
74 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
75 if (base::ThreadTaskRunnerHandle::IsSet()) {
76 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
77 this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get());
78 }
79 } 62 }
80 63
81 RasterSource::~RasterSource() { 64 RasterSource::~RasterSource() {
82 // For MemoryDumpProvider deregistration to work correctly, this must happen
83 // on the same thread that the RasterSource was created on.
84 DCHECK(memory_dump_thread_checker_.CalledOnValidThread());
85 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
86 this);
87 } 65 }
88 66
89 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, 67 void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas,
90 const gfx::Rect& canvas_bitmap_rect, 68 const gfx::Rect& canvas_bitmap_rect,
91 const gfx::Rect& canvas_playback_rect, 69 const gfx::Rect& canvas_playback_rect,
92 float contents_scale, 70 float contents_scale,
93 const PlaybackSettings& settings) const { 71 const PlaybackSettings& settings) const {
94 if (!settings.playback_to_shared_canvas) { 72 if (!settings.playback_to_shared_canvas) {
95 PrepareForPlaybackToCanvas(raster_canvas, canvas_bitmap_rect, 73 PrepareForPlaybackToCanvas(raster_canvas, canvas_bitmap_rect,
96 canvas_playback_rect, contents_scale); 74 canvas_playback_rect, contents_scale);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 bool can_use_lcd_text = false; 302 bool can_use_lcd_text = false;
325 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); 303 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text));
326 } 304 }
327 305
328 void RasterSource::SetImageDecodeController( 306 void RasterSource::SetImageDecodeController(
329 ImageDecodeController* image_decode_controller) { 307 ImageDecodeController* image_decode_controller) {
330 DCHECK(image_decode_controller); 308 DCHECK(image_decode_controller);
331 image_decode_controller_ = image_decode_controller; 309 image_decode_controller_ = image_decode_controller;
332 } 310 }
333 311
334 bool RasterSource::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
335 base::trace_event::ProcessMemoryDump* pmd) {
336 DCHECK(memory_dump_thread_checker_.CalledOnValidThread());
337
338 uint64_t memory_usage = GetPictureMemoryUsage();
339 if (memory_usage > 0) {
340 std::string dump_name =
341 base::StringPrintf("cc/display_lists/raster_source_%p", this);
342 base::trace_event::MemoryAllocatorDump* dump =
343 pmd->CreateAllocatorDump(dump_name);
344 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
345 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
346 memory_usage);
347 }
348 return true;
349 }
350
351 RasterSource::PlaybackSettings::PlaybackSettings() 312 RasterSource::PlaybackSettings::PlaybackSettings()
352 : playback_to_shared_canvas(false), 313 : playback_to_shared_canvas(false),
353 skip_images(false), 314 skip_images(false),
354 use_image_hijack_canvas(true) {} 315 use_image_hijack_canvas(true) {}
355 316
356 } // namespace cc 317 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/raster_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698