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

Side by Side Diff: components/exo/surface.cc

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 private: 140 private:
141 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter); 141 DISALLOW_COPY_AND_ASSIGN(CustomWindowTargeter);
142 }; 142 };
143 143
144 void SatisfyCallback(cc::SurfaceManager* manager, 144 void SatisfyCallback(cc::SurfaceManager* manager,
145 const cc::SurfaceSequence& sequence) { 145 const cc::SurfaceSequence& sequence) {
146 std::vector<uint32_t> sequences; 146 std::vector<uint32_t> sequences;
147 sequences.push_back(sequence.sequence); 147 sequences.push_back(sequence.sequence);
148 manager->DidSatisfySequences(sequence.client_id, &sequences); 148 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
149 } 149 }
150 150
151 void RequireCallback(cc::SurfaceManager* manager, 151 void RequireCallback(cc::SurfaceManager* manager,
152 const cc::SurfaceId& id, 152 const cc::SurfaceId& id,
153 const cc::SurfaceSequence& sequence) { 153 const cc::SurfaceSequence& sequence) {
154 cc::Surface* surface = manager->GetSurfaceForId(id); 154 cc::Surface* surface = manager->GetSurfaceForId(id);
155 if (!surface) { 155 if (!surface) {
156 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; 156 LOG(ERROR) << "Attempting to require callback on nonexistent surface";
157 return; 157 return;
158 } 158 }
(...skipping 28 matching lines...) Expand all
187 } 187 }
188 188
189 void SurfaceFactoryOwner::SetBeginFrameSource( 189 void SurfaceFactoryOwner::SetBeginFrameSource(
190 cc::BeginFrameSource* begin_frame_source) {} 190 cc::BeginFrameSource* begin_frame_source) {}
191 191
192 //////////////////////////////////////////////////////////////////////////////// 192 ////////////////////////////////////////////////////////////////////////////////
193 // SurfaceFactoryOwner, private: 193 // SurfaceFactoryOwner, private:
194 194
195 SurfaceFactoryOwner::~SurfaceFactoryOwner() { 195 SurfaceFactoryOwner::~SurfaceFactoryOwner() {
196 if (surface_factory_->manager()) { 196 if (surface_factory_->manager()) {
197 surface_factory_->manager()->InvalidateSurfaceClientId( 197 surface_factory_->manager()->InvalidateFrameSinkId(
198 id_allocator_->client_id()); 198 id_allocator_->frame_sink_id());
199 } 199 }
200 } 200 }
201 201
202 //////////////////////////////////////////////////////////////////////////////// 202 ////////////////////////////////////////////////////////////////////////////////
203 // Surface, public: 203 // Surface, public:
204 204
205 Surface::Surface() 205 Surface::Surface()
206 : window_(new aura::Window(new CustomWindowDelegate(this))), 206 : window_(new aura::Window(new CustomWindowDelegate(this))),
207 surface_manager_( 207 surface_manager_(
208 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), 208 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()),
209 factory_owner_(new SurfaceFactoryOwner) { 209 factory_owner_(new SurfaceFactoryOwner) {
210 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 210 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
211 window_->SetName("ExoSurface"); 211 window_->SetName("ExoSurface");
212 window_->SetProperty(kSurfaceKey, this); 212 window_->SetProperty(kSurfaceKey, this);
213 window_->Init(ui::LAYER_SOLID_COLOR); 213 window_->Init(ui::LAYER_SOLID_COLOR);
214 window_->set_layer_owner_delegate(this); 214 window_->set_layer_owner_delegate(this);
215 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); 215 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter));
216 window_->set_owned_by_parent(false); 216 window_->set_owned_by_parent(false);
217 factory_owner_->surface_ = this; 217 factory_owner_->surface_ = this;
218 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator( 218 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator(
219 aura::Env::GetInstance()->context_factory()->AllocateSurfaceClientId())); 219 aura::Env::GetInstance()->context_factory()->AllocateFrameSinkId()));
220 surface_manager_->RegisterSurfaceClientId( 220 surface_manager_->RegisterFrameSinkId(
221 factory_owner_->id_allocator_->client_id()); 221 factory_owner_->id_allocator_->frame_sink_id());
222 factory_owner_->surface_factory_.reset( 222 factory_owner_->surface_factory_.reset(
223 new cc::SurfaceFactory(surface_manager_, factory_owner_.get())); 223 new cc::SurfaceFactory(surface_manager_, factory_owner_.get()));
224 aura::Env::GetInstance()->context_factory()->AddObserver(this); 224 aura::Env::GetInstance()->context_factory()->AddObserver(this);
225 } 225 }
226 226
227 Surface::~Surface() { 227 Surface::~Surface() {
228 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); 228 aura::Env::GetInstance()->context_factory()->RemoveObserver(this);
229 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this)); 229 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this));
230 230
231 window_->layer()->SetShowSolidColorContent(); 231 window_->layer()->SetShowSolidColorContent();
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 846
847 int64_t Surface::GetPropertyInternal(const void* key, 847 int64_t Surface::GetPropertyInternal(const void* key,
848 int64_t default_value) const { 848 int64_t default_value) const {
849 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 849 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
850 if (iter == prop_map_.end()) 850 if (iter == prop_map_.end())
851 return default_value; 851 return default_value;
852 return iter->second.value; 852 return iter->second.value;
853 } 853 }
854 854
855 } // namespace exo 855 } // namespace exo
OLDNEW
« no previous file with comments | « cc/trees/surface_sequence_generator.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698