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

Side by Side Diff: ui/aura/mus/client_surface_embedder.cc

Issue 2616403003: Replacing SurfaceReferenceBase and SequenceSurfaceReference with Closures (Closed)
Patch Set: c Created 3 years, 11 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "ui/aura/mus/client_surface_embedder.h" 5 #include "ui/aura/mus/client_surface_embedder.h"
6 6
7 #include "cc/surfaces/scoped_surface_reference.h"
7 #include "cc/surfaces/surface_reference_factory.h" 8 #include "cc/surfaces/surface_reference_factory.h"
8 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
9 10
10 namespace aura { 11 namespace aura {
11 namespace { 12 namespace {
12 13
13 // TODO(mfomitchev, samans): Remove these stub classes once the SurfaceReference 14 // TODO(mfomitchev, samans): Remove these stub classes once the SurfaceReference
14 // work is complete. 15 // work is complete.
15 class StubSurfaceReference : public cc::SurfaceReferenceBase {
16 public:
17 StubSurfaceReference(scoped_refptr<const cc::SurfaceReferenceFactory> factory)
18 : cc::SurfaceReferenceBase(factory) {}
19
20 ~StubSurfaceReference() override { Destroy(); }
21
22 private:
23 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReference);
24 };
25
26 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory { 16 class StubSurfaceReferenceFactory : public cc::SurfaceReferenceFactory {
27 public: 17 public:
28 StubSurfaceReferenceFactory() = default; 18 StubSurfaceReferenceFactory() = default;
29 19
30 // cc::SurfaceReferenceFactory: 20 // cc::SurfaceReferenceFactory:
31 std::unique_ptr<cc::SurfaceReferenceBase> CreateReference( 21 std::unique_ptr<cc::ScopedSurfaceReferenceBase> CreateReference(
32 cc::SurfaceReferenceOwner* owner, 22 cc::SurfaceReferenceOwner* owner,
33 const cc::SurfaceId& surface_id) const override { 23 const cc::SurfaceId& surface_id) const override {
34 return base::MakeUnique<StubSurfaceReference>(make_scoped_refptr(this)); 24 return base::MakeUnique<cc::ScopedSurfaceReference>(
25 make_scoped_refptr(this), cc::SurfaceReference());
35 } 26 }
36 27
37 protected: 28 protected:
38 ~StubSurfaceReferenceFactory() override = default; 29 ~StubSurfaceReferenceFactory() override = default;
39 30
40 private: 31 private:
41 // cc::SurfaceReferenceFactory: 32 // cc::SurfaceReferenceFactory:
42 void DestroyReference(cc::SurfaceReferenceBase* surface_ref) const override {} 33 void DestroyReference(
34 cc::ScopedSurfaceReferenceBase* surface_ref) const override {}
43 35
44 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory); 36 DISALLOW_COPY_AND_ASSIGN(StubSurfaceReferenceFactory);
45 }; 37 };
46 } // namespace 38 } // namespace
47 39
48 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) { 40 ClientSurfaceEmbedder::ClientSurfaceEmbedder(Window* window) : window_(window) {
49 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED); 41 surface_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED);
50 surface_layer_->SetVisible(true); 42 surface_layer_->SetVisible(true);
51 // The frame provided by the parent window->layer() needs to show through 43 // The frame provided by the parent window->layer() needs to show through
52 // the surface layer. 44 // the surface layer.
(...skipping 27 matching lines...) Expand all
80 gfx::Rect(0, 0, frame_size.width(), frame_size.height())); 72 gfx::Rect(0, 0, frame_size.width(), frame_size.height()));
81 // Clip to window bounds. 73 // Clip to window bounds.
82 clip_layer_->SetBounds( 74 clip_layer_->SetBounds(
83 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height())); 75 gfx::Rect(0, 0, window_->bounds().width(), window_->bounds().height()));
84 76
85 surface_layer_->SetShowSurface( 77 surface_layer_->SetShowSurface(
86 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory)); 78 surface_info, make_scoped_refptr(new StubSurfaceReferenceFactory));
87 } 79 }
88 80
89 } // namespace aura 81 } // namespace aura
OLDNEW
« cc/surfaces/sequence_surface_reference_factory.cc ('K') | « ui/aura/mus/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698