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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 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
« no previous file with comments | « ui/compositor/float_animation_curve_adapter.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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "cc/base/region.h" 18 #include "cc/base/region.h"
19 #include "cc/layers/content_layer_client.h" 19 #include "cc/layers/content_layer_client.h"
20 #include "cc/layers/layer_client.h" 20 #include "cc/layers/layer_client.h"
21 #include "cc/layers/surface_layer.h" 21 #include "cc/layers/surface_layer.h"
22 #include "cc/layers/texture_layer_client.h" 22 #include "cc/layers/texture_layer_client.h"
23 #include "cc/resources/texture_mailbox.h" 23 #include "cc/resources/texture_mailbox.h"
24 #include "cc/surfaces/surface_id.h" 24 #include "cc/surfaces/surface_id.h"
25 #include "third_party/skia/include/core/SkColor.h" 25 #include "third_party/skia/include/core/SkColor.h"
26 #include "third_party/skia/include/core/SkRegion.h" 26 #include "third_party/skia/include/core/SkRegion.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Return the target grayscale if animator is running, or the current 205 // Return the target grayscale if animator is running, or the current
206 // grayscale otherwise. 206 // grayscale otherwise.
207 float GetTargetGrayscale() const; 207 float GetTargetGrayscale() const;
208 208
209 // Zoom the background by a factor of |zoom|. The effect is blended along the 209 // Zoom the background by a factor of |zoom|. The effect is blended along the
210 // edge across |inset| pixels. 210 // edge across |inset| pixels.
211 void SetBackgroundZoom(float zoom, int inset); 211 void SetBackgroundZoom(float zoom, int inset);
212 212
213 // Set the shape of this layer. 213 // Set the shape of this layer.
214 SkRegion* alpha_shape() const { return alpha_shape_.get(); } 214 SkRegion* alpha_shape() const { return alpha_shape_.get(); }
215 void SetAlphaShape(scoped_ptr<SkRegion> region); 215 void SetAlphaShape(std::unique_ptr<SkRegion> region);
216 216
217 // Invert the layer. 217 // Invert the layer.
218 bool layer_inverted() const { return layer_inverted_; } 218 bool layer_inverted() const { return layer_inverted_; }
219 void SetLayerInverted(bool inverted); 219 void SetLayerInverted(bool inverted);
220 220
221 // Return the target opacity if animator is running, or the current opacity 221 // Return the target opacity if animator is running, or the current opacity
222 // otherwise. 222 // otherwise.
223 float GetTargetOpacity() const; 223 float GetTargetOpacity() const;
224 224
225 // Set a layer mask for a layer. 225 // Set a layer mask for a layer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 // Set to true if this layer always paints completely within its bounds. If so 267 // Set to true if this layer always paints completely within its bounds. If so
268 // we can omit an unnecessary clear, even if the layer is transparent. 268 // we can omit an unnecessary clear, even if the layer is transparent.
269 void SetFillsBoundsCompletely(bool fills_bounds_completely); 269 void SetFillsBoundsCompletely(bool fills_bounds_completely);
270 270
271 const std::string& name() const { return name_; } 271 const std::string& name() const { return name_; }
272 void set_name(const std::string& name) { name_ = name; } 272 void set_name(const std::string& name) { name_ = name; }
273 273
274 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a 274 // Set new TextureMailbox for this layer. Note that |mailbox| may hold a
275 // shared memory resource or an actual mailbox for a texture. 275 // shared memory resource or an actual mailbox for a texture.
276 void SetTextureMailbox(const cc::TextureMailbox& mailbox, 276 void SetTextureMailbox(
277 scoped_ptr<cc::SingleReleaseCallback> release_callback, 277 const cc::TextureMailbox& mailbox,
278 gfx::Size texture_size_in_dip); 278 std::unique_ptr<cc::SingleReleaseCallback> release_callback,
279 gfx::Size texture_size_in_dip);
279 void SetTextureSize(gfx::Size texture_size_in_dip); 280 void SetTextureSize(gfx::Size texture_size_in_dip);
280 void SetTextureFlipped(bool flipped); 281 void SetTextureFlipped(bool flipped);
281 bool TextureFlipped() const; 282 bool TextureFlipped() const;
282 283
283 // Begins showing content from a surface with a particular id. 284 // Begins showing content from a surface with a particular id.
284 void SetShowSurface(cc::SurfaceId surface_id, 285 void SetShowSurface(cc::SurfaceId surface_id,
285 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback, 286 const cc::SurfaceLayer::SatisfyCallback& satisfy_callback,
286 const cc::SurfaceLayer::RequireCallback& require_callback, 287 const cc::SurfaceLayer::RequireCallback& require_callback,
287 gfx::Size surface_size, 288 gfx::Size surface_size,
288 float scale, 289 float scale,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void SuppressPaint(); 329 void SuppressPaint();
329 330
330 // Notifies the layer that the device scale factor has changed. 331 // Notifies the layer that the device scale factor has changed.
331 void OnDeviceScaleFactorChanged(float device_scale_factor); 332 void OnDeviceScaleFactorChanged(float device_scale_factor);
332 333
333 // Notifies the layer that one of its children has received a new 334 // Notifies the layer that one of its children has received a new
334 // delegated frame. 335 // delegated frame.
335 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip); 336 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip);
336 337
337 // Requets a copy of the layer's output as a texture or bitmap. 338 // Requets a copy of the layer's output as a texture or bitmap.
338 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request); 339 void RequestCopyOfOutput(std::unique_ptr<cc::CopyOutputRequest> request);
339 340
340 // ContentLayerClient 341 // ContentLayerClient
341 gfx::Rect PaintableRegion() override; 342 gfx::Rect PaintableRegion() override;
342 scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList( 343 scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList(
343 ContentLayerClient::PaintingControlSetting painting_control) override; 344 ContentLayerClient::PaintingControlSetting painting_control) override;
344 bool FillsBoundsCompletely() const override; 345 bool FillsBoundsCompletely() const override;
345 size_t GetApproximateUnsharedMemoryUsage() const override; 346 size_t GetApproximateUnsharedMemoryUsage() const override;
346 347
347 cc::Layer* cc_layer_for_testing() { return cc_layer_; } 348 cc::Layer* cc_layer_for_testing() { return cc_layer_; }
348 349
349 // TextureLayerClient 350 // TextureLayerClient
350 bool PrepareTextureMailbox( 351 bool PrepareTextureMailbox(
351 cc::TextureMailbox* mailbox, 352 cc::TextureMailbox* mailbox,
352 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 353 std::unique_ptr<cc::SingleReleaseCallback>* release_callback,
353 bool use_shared_memory) override; 354 bool use_shared_memory) override;
354 355
355 float device_scale_factor() const { return device_scale_factor_; } 356 float device_scale_factor() const { return device_scale_factor_; }
356 357
357 // Forces a render surface to be used on this layer. This has no positive 358 // Forces a render surface to be used on this layer. This has no positive
358 // impact, and is only used for benchmarking/testing purpose. 359 // impact, and is only used for benchmarking/testing purpose.
359 void SetForceRenderSurface(bool force); 360 void SetForceRenderSurface(bool force);
360 bool force_render_surface() const { return force_render_surface_; } 361 bool force_render_surface() const { return force_render_surface_; }
361 362
362 // LayerClient 363 // LayerClient
363 scoped_ptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo( 364 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> TakeDebugInfo(
364 cc::Layer* layer) override; 365 cc::Layer* layer) override;
365 366
366 // Whether this layer has animations waiting to get sent to its cc::Layer. 367 // Whether this layer has animations waiting to get sent to its cc::Layer.
367 bool HasPendingThreadedAnimationsForTesting() const; 368 bool HasPendingThreadedAnimationsForTesting() const;
368 369
369 // Triggers a call to SwitchToLayer. 370 // Triggers a call to SwitchToLayer.
370 void SwitchCCLayerForTest(); 371 void SwitchCCLayerForTest();
371 372
372 private: 373 private:
373 friend class LayerOwner; 374 friend class LayerOwner;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 Layer* layer_mask_back_link_; 463 Layer* layer_mask_back_link_;
463 464
464 // The zoom factor to scale the layer by. Zooming is disabled when this is 465 // The zoom factor to scale the layer by. Zooming is disabled when this is
465 // set to 1. 466 // set to 1.
466 float zoom_; 467 float zoom_;
467 468
468 // Width of the border in pixels, where the scaling is blended. 469 // Width of the border in pixels, where the scaling is blended.
469 int zoom_inset_; 470 int zoom_inset_;
470 471
471 // Shape of the window. 472 // Shape of the window.
472 scoped_ptr<SkRegion> alpha_shape_; 473 std::unique_ptr<SkRegion> alpha_shape_;
473 474
474 std::string name_; 475 std::string name_;
475 476
476 LayerDelegate* delegate_; 477 LayerDelegate* delegate_;
477 478
478 LayerOwner* owner_; 479 LayerOwner* owner_;
479 480
480 scoped_refptr<LayerAnimator> animator_; 481 scoped_refptr<LayerAnimator> animator_;
481 482
482 // Ownership of the layer is held through one of the strongly typed layer 483 // Ownership of the layer is held through one of the strongly typed layer
(...skipping 11 matching lines...) Expand all
494 // A cached copy of the nine patch layer's image and aperture. 495 // A cached copy of the nine patch layer's image and aperture.
495 // These are required for device scale factor change. 496 // These are required for device scale factor change.
496 gfx::ImageSkia nine_patch_layer_image_; 497 gfx::ImageSkia nine_patch_layer_image_;
497 gfx::Rect nine_patch_layer_aperture_; 498 gfx::Rect nine_patch_layer_aperture_;
498 499
499 // The mailbox used by texture_layer_. 500 // The mailbox used by texture_layer_.
500 cc::TextureMailbox mailbox_; 501 cc::TextureMailbox mailbox_;
501 502
502 // The callback to release the mailbox. This is only set after 503 // The callback to release the mailbox. This is only set after
503 // SetTextureMailbox is called, before we give it to the TextureLayer. 504 // SetTextureMailbox is called, before we give it to the TextureLayer.
504 scoped_ptr<cc::SingleReleaseCallback> mailbox_release_callback_; 505 std::unique_ptr<cc::SingleReleaseCallback> mailbox_release_callback_;
505 506
506 // The size of the frame or texture in DIP, set when SetShowDelegatedContent 507 // The size of the frame or texture in DIP, set when SetShowDelegatedContent
507 // or SetTextureMailbox was called. 508 // or SetTextureMailbox was called.
508 gfx::Size frame_size_in_dip_; 509 gfx::Size frame_size_in_dip_;
509 510
510 DISALLOW_COPY_AND_ASSIGN(Layer); 511 DISALLOW_COPY_AND_ASSIGN(Layer);
511 }; 512 };
512 513
513 } // namespace ui 514 } // namespace ui
514 515
515 #endif // UI_COMPOSITOR_LAYER_H_ 516 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « ui/compositor/float_animation_curve_adapter.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698