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

Unified Diff: cc/managed_tile_state.h

Issue 12353003: cc: Refactored Tile::GetResourceId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/cc.gyp ('k') | cc/managed_tile_state.cc » ('j') | cc/managed_tile_state.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/managed_tile_state.h
diff --git a/cc/managed_tile_state.h b/cc/managed_tile_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..7fc479109d15b5dec94a19eeafa62779f37d9d2e
--- /dev/null
+++ b/cc/managed_tile_state.h
@@ -0,0 +1,116 @@
+// Copyright 2013 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.
+
+#ifndef CC_MANAGED_TILE_STATE_H_
+#define CC_MANAGED_TILE_STATE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "cc/resource_pool.h"
+#include "cc/resource_provider.h"
+#include "cc/tile_manager.h"
+
+namespace cc {
+
+class TileManager;
+
+// This is state that is specific to a tile that is
+// managed by the TileManager.
+class CC_EXPORT ManagedTileState {
+ public:
+
reveman 2013/03/12 22:47:02 nit: no blank line here please
+ class CC_EXPORT DrawingInfo {
+ public:
+ enum Mode {
+ TEXTURE_MODE,
+ SOLID_COLOR_MODE,
+ TRANSPARENT_MODE,
+ PICTURE_PILE_MODE,
+ NUM_MODES
+ };
+
+ DrawingInfo()
+ : mode_(TEXTURE_MODE),
+ resource_is_being_initialized_(false),
+ can_be_freed_(true),
+ contents_swizzled_(false) {}
+
+ Mode mode() const {
+ return mode_;
+ }
+
+ bool IsReadyToDraw() const;
+
+ ResourceProvider::ResourceId get_resource_id() const {
+ DCHECK(mode_ == TEXTURE_MODE);
+ DCHECK(resource_);
+ DCHECK(!resource_is_being_initialized_);
+ return resource_->id();
+ }
+
+ SkColor get_solid_color() const {
+ DCHECK(mode_ == SOLID_COLOR_MODE);
+
reveman 2013/03/12 22:47:02 nit: no trailing whitespace here please
+ return solid_color_;
+ }
+
+ bool contents_swizzled() const {
+ return contents_swizzled_;
+ }
+
+ scoped_ptr<ResourcePool::Resource>& GetResourceForTesting() {
+ return resource_;
+ }
+
+ private:
+ friend class TileManager;
+ friend class ManagedTileState;
+
+ void set_transparent() {
+ mode_ = TRANSPARENT_MODE;
+ }
+
+ void set_solid_color(const SkColor& color) {
+ mode_ = SOLID_COLOR_MODE;
+ solid_color_ = color;
+ }
+
+ Mode mode_;
+ SkColor solid_color_;
+
+ scoped_ptr<ResourcePool::Resource> resource_;
+ bool resource_is_being_initialized_;
+ bool can_be_freed_;
+ bool contents_swizzled_;
+ };
+
+
+ ManagedTileState();
+ ~ManagedTileState();
+ scoped_ptr<base::Value> AsValue() const;
+
+ // Persisted state: valid all the time.
+ bool can_use_gpu_memory;
+ bool need_to_gather_pixel_refs;
+ std::list<skia::LazyPixelRef*> pending_pixel_refs;
reveman 2013/03/12 22:47:02 add #include <list> above
+ TileRasterState raster_state;
+ DrawingInfo drawing_info;
+ PicturePileImpl::Analysis picture_pile_analysis;
+ bool picture_pile_analyzed;
+
+ // Ephemeral state, valid only during TileManager::ManageTiles.
+ TileManagerBin bin[NUM_BIN_PRIORITIES];
+ TileManagerBin tree_bin[NUM_TREES];
+
+ // The bin that the tile would have if the GPU memory manager had
+ // a maximally permissive policy, send to the GPU memory manager
+ // to determine policy.
+ TileManagerBin gpu_memmgr_stats_bin;
+ TileResolution resolution;
+ float time_to_needed_in_seconds;
+ float distance_to_visible_in_pixels;
+};
+
+} // namespace cc
reveman 2013/03/12 22:47:02 nit: 2 spaces between } and // please
+
+#endif
« no previous file with comments | « cc/cc.gyp ('k') | cc/managed_tile_state.cc » ('j') | cc/managed_tile_state.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698