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

Unified Diff: cc/raster/gpu_rasterizer.cc

Issue 1951193002: cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: vmpstr's review 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/raster/gpu_rasterizer.h ('k') | cc/raster/one_copy_raster_buffer_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/gpu_rasterizer.cc
diff --git a/cc/raster/gpu_rasterizer.cc b/cc/raster/gpu_rasterizer.cc
deleted file mode 100644
index 827235b2af8c490319448b5705608af270b276cd..0000000000000000000000000000000000000000
--- a/cc/raster/gpu_rasterizer.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/raster/gpu_rasterizer.h"
-
-#include <algorithm>
-
-#include "base/bind.h"
-#include "base/metrics/histogram.h"
-#include "base/trace_event/trace_event.h"
-#include "cc/debug/devtools_instrumentation.h"
-#include "cc/debug/frame_viewer_instrumentation.h"
-#include "cc/output/context_provider.h"
-#include "cc/playback/raster_source.h"
-#include "cc/raster/raster_buffer.h"
-#include "cc/raster/scoped_gpu_raster.h"
-#include "cc/resources/resource.h"
-#include "cc/tiles/tile_manager.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
-#include "third_party/skia/include/core/SkMultiPictureDraw.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
-#include "third_party/skia/include/core/SkSurface.h"
-#include "third_party/skia/include/gpu/GrContext.h"
-
-namespace cc {
-
-GpuRasterizer::GpuRasterizer(ContextProvider* worker_context_provider,
- ResourceProvider* resource_provider,
- bool use_distance_field_text,
- int msaa_sample_count)
- : worker_context_provider_(worker_context_provider),
- resource_provider_(resource_provider),
- use_distance_field_text_(use_distance_field_text),
- msaa_sample_count_(msaa_sample_count) {
- DCHECK(worker_context_provider_);
-}
-
-GpuRasterizer::~GpuRasterizer() {
-}
-
-void GpuRasterizer::RasterizeSource(
- ResourceProvider::ScopedWriteLockGr* write_lock,
- const RasterSource* raster_source,
- const gfx::Rect& raster_full_rect,
- const gfx::Rect& playback_rect,
- float scale,
- const RasterSource::PlaybackSettings& playback_settings) {
- // Play back raster_source into temp SkPicture.
- SkPictureRecorder recorder;
- const gfx::Size size = write_lock->GetResourceSize();
- const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag;
- sk_sp<SkCanvas> canvas = sk_ref_sp(
- recorder.beginRecording(size.width(), size.height(), NULL, flags));
- canvas->save();
- raster_source->PlaybackToCanvas(canvas.get(), raster_full_rect, playback_rect,
- scale, playback_settings);
- canvas->restore();
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
-
- // Turn on distance fields for layers that have ever animated.
- bool use_distance_field_text =
- use_distance_field_text_ ||
- raster_source->ShouldAttemptToUseDistanceFieldText();
-
- // Playback picture into resource.
- {
- ScopedGpuRaster gpu_raster(worker_context_provider_);
- write_lock->InitSkSurface(
- worker_context_provider_->GrContext(), use_distance_field_text,
- raster_source->CanUseLCDText(), msaa_sample_count_);
-
- SkSurface* sk_surface = write_lock->sk_surface();
-
- // Allocating an SkSurface will fail after a lost context. Pretend we
- // rasterized, as the contents of the resource don't matter anymore.
- if (!sk_surface)
- return;
-
- SkMultiPictureDraw multi_picture_draw;
- multi_picture_draw.add(sk_surface->getCanvas(), picture.get());
- multi_picture_draw.draw(false);
- write_lock->ReleaseSkSurface();
- }
-}
-
-} // namespace cc
« no previous file with comments | « cc/raster/gpu_rasterizer.h ('k') | cc/raster/one_copy_raster_buffer_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698