| Index: cc/resources/gpu_rasterizer.cc | 
| diff --git a/cc/resources/gpu_rasterizer.cc b/cc/resources/gpu_rasterizer.cc | 
| index d810386da94a2c9ff36475e59590e2d79ed92787..1620c2bd6425fed038ace873a7b69ec884efaf77 100644 | 
| --- a/cc/resources/gpu_rasterizer.cc | 
| +++ b/cc/resources/gpu_rasterizer.cc | 
| @@ -26,74 +26,19 @@ | 
|  | 
| namespace cc { | 
|  | 
| -// static | 
| -scoped_ptr<GpuRasterizer> GpuRasterizer::Create( | 
| -    ContextProvider* context_provider, | 
| -    ResourceProvider* resource_provider, | 
| -    bool use_distance_field_text, | 
| -    bool threaded_gpu_rasterization_enabled, | 
| -    int msaa_sample_count) { | 
| -  return make_scoped_ptr<GpuRasterizer>(new GpuRasterizer( | 
| -      context_provider, resource_provider, use_distance_field_text, | 
| -      threaded_gpu_rasterization_enabled, msaa_sample_count)); | 
| -} | 
| - | 
| GpuRasterizer::GpuRasterizer(ContextProvider* context_provider, | 
| ResourceProvider* resource_provider, | 
| bool use_distance_field_text, | 
| -                             bool threaded_gpu_rasterization_enabled, | 
| int msaa_sample_count) | 
| : resource_provider_(resource_provider), | 
| use_distance_field_text_(use_distance_field_text), | 
| -      threaded_gpu_rasterization_enabled_(threaded_gpu_rasterization_enabled), | 
| msaa_sample_count_(msaa_sample_count) { | 
| } | 
|  | 
| GpuRasterizer::~GpuRasterizer() { | 
| } | 
|  | 
| -PrepareTilesMode GpuRasterizer::GetPrepareTilesMode() { | 
| -  return threaded_gpu_rasterization_enabled_ | 
| -             ? PrepareTilesMode::RASTERIZE_PRIORITIZED_TILES | 
| -             : PrepareTilesMode::PREPARE_NONE; | 
| -} | 
| - | 
| -ContextProvider* GpuRasterizer::GetContextProvider(bool worker_context) { | 
| -  return worker_context | 
| -             ? resource_provider_->output_surface()->worker_context_provider() | 
| -             : resource_provider_->output_surface()->context_provider(); | 
| -} | 
| - | 
| -void GpuRasterizer::RasterizeTiles( | 
| -    const TileVector& tiles, | 
| -    ResourcePool* resource_pool, | 
| -    ResourceFormat resource_format, | 
| -    const UpdateTileDrawInfoCallback& update_tile_draw_info) { | 
| -  ScopedGpuRaster gpu_raster(GetContextProvider(false)); | 
| - | 
| -  ScopedResourceWriteLocks locks; | 
| - | 
| -  for (Tile* tile : tiles) { | 
| -    RasterSource::SolidColorAnalysis analysis; | 
| - | 
| -    if (tile->use_picture_analysis()) | 
| -      PerformSolidColorAnalysis(tile, &analysis); | 
| - | 
| -    scoped_ptr<ScopedResource> resource; | 
| -    if (!analysis.is_solid_color) { | 
| -      resource = resource_pool->AcquireResource(tile->desired_texture_size(), | 
| -                                                resource_format); | 
| -      AddToMultiPictureDraw(tile, resource.get(), &locks); | 
| -    } | 
| -    update_tile_draw_info.Run(tile, resource.Pass(), analysis); | 
| -  } | 
| - | 
| -  // If MSAA is enabled, tell Skia to resolve each render target after draw. | 
| -  multi_picture_draw_.draw(msaa_sample_count_ > 0); | 
| -} | 
| - | 
| void GpuRasterizer::RasterizeSource( | 
| -    bool use_worker_context, | 
| ResourceProvider::ScopedWriteLockGr* write_lock, | 
| const RasterSource* raster_source, | 
| const gfx::Rect& rect, | 
| @@ -116,8 +61,9 @@ void GpuRasterizer::RasterizeSource( | 
|  | 
| // Playback picture into resource. | 
| { | 
| -    ScopedGpuRaster gpu_raster(GetContextProvider(use_worker_context)); | 
| -    write_lock->InitSkSurface(use_worker_context, use_distance_field_text, | 
| +    ScopedGpuRaster gpu_raster( | 
| +        resource_provider_->output_surface()->worker_context_provider()); | 
| +    write_lock->InitSkSurface(use_distance_field_text, | 
| raster_source->CanUseLCDText(), | 
| msaa_sample_count_); | 
|  | 
| @@ -135,70 +81,4 @@ void GpuRasterizer::RasterizeSource( | 
| } | 
| } | 
|  | 
| -void GpuRasterizer::PerformSolidColorAnalysis( | 
| -    const Tile* tile, | 
| -    RasterSource::SolidColorAnalysis* analysis) { | 
| -  const void* tile_id = static_cast<const void*>(tile); | 
| -  frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task( | 
| -      tile_id, tile->combined_priority().resolution, | 
| -      tile->source_frame_number(), tile->layer_id()); | 
| - | 
| -  DCHECK(tile->raster_source()); | 
| - | 
| -  tile->raster_source()->PerformSolidColorAnalysis( | 
| -      tile->content_rect(), tile->contents_scale(), analysis); | 
| - | 
| -  // Record the solid color prediction. | 
| -  UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", | 
| -                        analysis->is_solid_color); | 
| -} | 
| - | 
| -void GpuRasterizer::AddToMultiPictureDraw(const Tile* tile, | 
| -                                          const ScopedResource* resource, | 
| -                                          ScopedResourceWriteLocks* locks) { | 
| -  const void* tile_id = static_cast<const void*>(tile); | 
| -  frame_viewer_instrumentation::ScopedRasterTask raster_task( | 
| -      tile_id, tile->combined_priority().resolution, | 
| -      tile->source_frame_number(), tile->layer_id()); | 
| - | 
| -  DCHECK(tile->raster_source()); | 
| - | 
| -  // Turn on distance fields for layers that have ever animated. | 
| -  bool use_distance_field_text = | 
| -      use_distance_field_text_ || | 
| -      tile->raster_source()->ShouldAttemptToUseDistanceFieldText(); | 
| -  scoped_ptr<ResourceProvider::ScopedWriteLockGr> lock( | 
| -      new ResourceProvider::ScopedWriteLockGr(resource_provider_, | 
| -                                              resource->id())); | 
| - | 
| -  lock->InitSkSurface(false, use_distance_field_text, | 
| -                      tile->raster_source()->CanUseLCDText(), | 
| -                      msaa_sample_count_); | 
| - | 
| -  SkSurface* sk_surface = 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; | 
| - | 
| -  locks->push_back(lock.Pass()); | 
| - | 
| -  SkRTreeFactory factory; | 
| -  SkPictureRecorder recorder; | 
| -  gfx::Size size = resource->size(); | 
| -  const int flags = SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag; | 
| -  skia::RefPtr<SkCanvas> canvas = skia::SharePtr( | 
| -      recorder.beginRecording(size.width(), size.height(), &factory, flags)); | 
| - | 
| -  canvas->save(); | 
| -  tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), | 
| -                                          tile->contents_scale()); | 
| -  canvas->restore(); | 
| - | 
| -  // Add the canvas and recorded picture to |multi_picture_draw_|. | 
| -  skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 
| -  multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); | 
| -} | 
| - | 
| }  // namespace cc | 
|  |