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

Side by Side Diff: ui/compositor/layer.h

Issue 228083002: Make ReflectorImpl use mailboxes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef UI_COMPOSITOR_LAYER_H_ 5 #ifndef UI_COMPOSITOR_LAYER_H_
6 #define UI_COMPOSITOR_LAYER_H_ 6 #define UI_COMPOSITOR_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 30 matching lines...) Expand all
41 class TextureLayer; 41 class TextureLayer;
42 struct ReturnedResource; 42 struct ReturnedResource;
43 typedef std::vector<ReturnedResource> ReturnedResourceArray; 43 typedef std::vector<ReturnedResource> ReturnedResourceArray;
44 } 44 }
45 45
46 namespace ui { 46 namespace ui {
47 47
48 class Compositor; 48 class Compositor;
49 class LayerAnimator; 49 class LayerAnimator;
50 class LayerOwner; 50 class LayerOwner;
51 class Texture;
52 51
53 // Layer manages a texture, transform and a set of child Layers. Any View that 52 // Layer manages a texture, transform and a set of child Layers. Any View that
54 // has enabled layers ends up creating a Layer to manage the texture. 53 // has enabled layers ends up creating a Layer to manage the texture.
55 // A Layer can also be created without a texture, in which case it renders 54 // A Layer can also be created without a texture, in which case it renders
56 // nothing and is simply used as a node in a hierarchy of layers. 55 // nothing and is simply used as a node in a hierarchy of layers.
57 // Coordinate system used in layers is DIP (Density Independent Pixel) 56 // Coordinate system used in layers is DIP (Density Independent Pixel)
58 // coordinates unless explicitly mentioned as pixel coordinates. 57 // coordinates unless explicitly mentioned as pixel coordinates.
59 // 58 //
60 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you 59 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you
61 // delete a Layer and it has children, the parent of each child Layer is set to 60 // delete a Layer and it has children, the parent of each child Layer is set to
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void SetFillsBoundsOpaquely(bool fills_bounds_opaquely); 248 void SetFillsBoundsOpaquely(bool fills_bounds_opaquely);
250 bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; } 249 bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; }
251 250
252 // Set to true if this layer always paints completely within its bounds. If so 251 // Set to true if this layer always paints completely within its bounds. If so
253 // we can omit an unnecessary clear, even if the layer is transparent. 252 // we can omit an unnecessary clear, even if the layer is transparent.
254 void SetFillsBoundsCompletely(bool fills_bounds_completely); 253 void SetFillsBoundsCompletely(bool fills_bounds_completely);
255 254
256 const std::string& name() const { return name_; } 255 const std::string& name() const { return name_; }
257 void set_name(const std::string& name) { name_ = name; } 256 void set_name(const std::string& name) { name_ = name; }
258 257
259 const ui::Texture* texture() const { return texture_.get(); }
260
261 // Assigns a new external texture. |texture| can be NULL to disable external
262 // updates.
263 void SetExternalTexture(ui::Texture* texture);
264 ui::Texture* external_texture() { return texture_.get(); }
265
266 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a 258 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a
267 // shared memory resource or an actual mailbox for a texture. 259 // shared memory resource or an actual mailbox for a texture.
268 void SetTextureMailbox(const cc::TextureMailbox& mailbox, 260 void SetTextureMailbox(const cc::TextureMailbox& mailbox,
269 scoped_ptr<cc::SingleReleaseCallback> release_callback, 261 scoped_ptr<cc::SingleReleaseCallback> release_callback,
270 float scale_factor); 262 gfx::Size texture_size_in_dip);
271 cc::TextureMailbox GetTextureMailbox(float* scale_factor); 263 void SetTextureSize(gfx::Size texture_size_in_dip);
272 264
273 // Begins showing delegated frames from the |frame_provider|. 265 // Begins showing delegated frames from the |frame_provider|.
274 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, 266 void SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider,
275 gfx::Size frame_size_in_dip); 267 gfx::Size frame_size_in_dip);
276 268
277 bool has_external_content() { 269 bool has_external_content() {
278 return texture_layer_.get() || delegated_renderer_layer_.get(); 270 return texture_layer_.get() || delegated_renderer_layer_.get();
279 } 271 }
280 272
281 void SetShowPaintedContent(); 273 void SetShowPaintedContent();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // We cannot send animations to our cc_layer_ until we have been added to a 399 // We cannot send animations to our cc_layer_ until we have been added to a
408 // layer tree. Instead, we hold on to these animations in 400 // layer tree. Instead, we hold on to these animations in
409 // pending_threaded_animations_, and expect SendPendingThreadedAnimations to 401 // pending_threaded_animations_, and expect SendPendingThreadedAnimations to
410 // be called once we have been added to a tree. 402 // be called once we have been added to a tree.
411 void SendPendingThreadedAnimations(); 403 void SendPendingThreadedAnimations();
412 404
413 const LayerType type_; 405 const LayerType type_;
414 406
415 Compositor* compositor_; 407 Compositor* compositor_;
416 408
417 scoped_refptr<ui::Texture> texture_;
418
419 Layer* parent_; 409 Layer* parent_;
420 410
421 // This layer's children, in bottom-to-top stacking order. 411 // This layer's children, in bottom-to-top stacking order.
422 std::vector<Layer*> children_; 412 std::vector<Layer*> children_;
423 413
424 gfx::Rect bounds_; 414 gfx::Rect bounds_;
425 415
426 // Visibility of this layer. See SetVisible/IsDrawn for more details. 416 // Visibility of this layer. See SetVisible/IsDrawn for more details.
427 bool visible_; 417 bool visible_;
428 418
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_; 468 scoped_refptr<cc::DelegatedRendererLayer> delegated_renderer_layer_;
479 cc::Layer* cc_layer_; 469 cc::Layer* cc_layer_;
480 470
481 // If true, the layer scales the canvas and the texture with the device scale 471 // If true, the layer scales the canvas and the texture with the device scale
482 // factor as apporpriate. When true, the texture size is in DIP. 472 // factor as apporpriate. When true, the texture size is in DIP.
483 bool scale_content_; 473 bool scale_content_;
484 474
485 // A cached copy of |Compositor::device_scale_factor()|. 475 // A cached copy of |Compositor::device_scale_factor()|.
486 float device_scale_factor_; 476 float device_scale_factor_;
487 477
488 // A cached copy of the TextureMailbox given texture_layer_. 478 // The mailbox used by texture_layer_.
489 cc::TextureMailbox mailbox_; 479 cc::TextureMailbox mailbox_;
490 480
491 // Device scale factor in which mailbox_ was rendered in. 481 // The callback to release the mailbox. This is only set after
492 float mailbox_scale_factor_; 482 // SetTextureMailbox is called, before we give it to the TextureLayer.
483 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_;
493 484
494 // The size of the delegated frame in DIP, set when SetShowDelegatedContent 485 // The size of the frame or texture in DIP, set when SetShowDelegatedContent
495 // was called. 486 // or SetTextureMailbox was called.
496 gfx::Size delegated_frame_size_in_dip_; 487 gfx::Size frame_size_in_dip_;
497 488
498 DISALLOW_COPY_AND_ASSIGN(Layer); 489 DISALLOW_COPY_AND_ASSIGN(Layer);
499 }; 490 };
500 491
501 } // namespace ui 492 } // namespace ui
502 493
503 #endif // UI_COMPOSITOR_LAYER_H_ 494 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698