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

Side by Side Diff: cc/resources/resource_provider.cc

Issue 801973002: Introduce CompositorDependencies for RenderWidgetCompositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compdep: . Created 6 years 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/cc_tests.gyp ('k') | cc/test/fake_external_begin_frame_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 format); 548 format);
549 resource.allocated = false; 549 resource.allocated = false;
550 resources_[id] = resource; 550 resources_[id] = resource;
551 return id; 551 return id;
552 } 552 }
553 553
554 ResourceProvider::ResourceId ResourceProvider::CreateBitmap( 554 ResourceProvider::ResourceId ResourceProvider::CreateBitmap(
555 const gfx::Size& size, GLint wrap_mode) { 555 const gfx::Size& size, GLint wrap_mode) {
556 DCHECK(thread_checker_.CalledOnValidThread()); 556 DCHECK(thread_checker_.CalledOnValidThread());
557 557
558 scoped_ptr<SharedBitmap> bitmap; 558 scoped_ptr<SharedBitmap> bitmap =
559 if (shared_bitmap_manager_) 559 shared_bitmap_manager_->AllocateSharedBitmap(size);
560 bitmap = shared_bitmap_manager_->AllocateSharedBitmap(size); 560 uint8_t* pixels = bitmap->pixels();
561
562 uint8_t* pixels;
563 if (bitmap) {
564 pixels = bitmap->pixels();
565 } else {
566 size_t bytes = SharedBitmap::CheckedSizeInBytes(size);
567 pixels = new uint8_t[bytes];
568 }
569 DCHECK(pixels); 561 DCHECK(pixels);
570 562
571 ResourceId id = next_id_++; 563 ResourceId id = next_id_++;
572 Resource resource( 564 Resource resource(
573 pixels, bitmap.release(), size, Resource::Internal, GL_LINEAR, wrap_mode); 565 pixels, bitmap.release(), size, Resource::Internal, GL_LINEAR, wrap_mode);
574 resource.allocated = true; 566 resource.allocated = true;
575 resources_[id] = resource; 567 resources_[id] = resource;
576 return id; 568 return id;
577 } 569 }
578 570
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 ContextProvider* context_provider = output_surface_->context_provider(); 2133 ContextProvider* context_provider = output_surface_->context_provider();
2142 return context_provider ? context_provider->ContextGL() : NULL; 2134 return context_provider ? context_provider->ContextGL() : NULL;
2143 } 2135 }
2144 2136
2145 class GrContext* ResourceProvider::GrContext() const { 2137 class GrContext* ResourceProvider::GrContext() const {
2146 ContextProvider* context_provider = output_surface_->context_provider(); 2138 ContextProvider* context_provider = output_surface_->context_provider();
2147 return context_provider ? context_provider->GrContext() : NULL; 2139 return context_provider ? context_provider->GrContext() : NULL;
2148 } 2140 }
2149 2141
2150 } // namespace cc 2142 } // namespace cc
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/test/fake_external_begin_frame_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698