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

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

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 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 | « cc/trees/layer_tree_host.h ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('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 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), 203 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()),
204 factory_owner_(new SurfaceFactoryOwner) { 204 factory_owner_(new SurfaceFactoryOwner) {
205 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 205 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
206 window_->SetName("ExoSurface"); 206 window_->SetName("ExoSurface");
207 window_->SetProperty(kSurfaceKey, this); 207 window_->SetProperty(kSurfaceKey, this);
208 window_->Init(ui::LAYER_SOLID_COLOR); 208 window_->Init(ui::LAYER_SOLID_COLOR);
209 window_->set_layer_owner_delegate(this); 209 window_->set_layer_owner_delegate(this);
210 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); 210 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter));
211 window_->set_owned_by_parent(false); 211 window_->set_owned_by_parent(false);
212 factory_owner_->surface_ = this; 212 factory_owner_->surface_ = this;
213 uint32_t client_id =
214 aura::Env::GetInstance()->context_factory()->AllocateSurfaceClientId();
213 factory_owner_->id_allocator_ = 215 factory_owner_->id_allocator_ =
214 aura::Env::GetInstance()->context_factory()->CreateSurfaceIdAllocator(); 216 base::WrapUnique(new cc::SurfaceIdAllocator(client_id));
215 factory_owner_->surface_factory_.reset( 217 factory_owner_->surface_factory_.reset(new cc::SurfaceFactory(
216 new cc::SurfaceFactory(surface_manager_, factory_owner_.get())); 218 client_id, surface_manager_, factory_owner_.get()));
217 aura::Env::GetInstance()->context_factory()->AddObserver(this); 219 aura::Env::GetInstance()->context_factory()->AddObserver(this);
218 } 220 }
219 221
220 Surface::~Surface() { 222 Surface::~Surface() {
221 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); 223 aura::Env::GetInstance()->context_factory()->RemoveObserver(this);
222 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this)); 224 FOR_EACH_OBSERVER(SurfaceObserver, observers_, OnSurfaceDestroying(this));
223 225
224 window_->layer()->SetShowSolidColorContent(); 226 window_->layer()->SetShowSolidColorContent();
225 227
226 factory_owner_->surface_ = nullptr; 228 factory_owner_->surface_ = nullptr;
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 838
837 int64_t Surface::GetPropertyInternal(const void* key, 839 int64_t Surface::GetPropertyInternal(const void* key,
838 int64_t default_value) const { 840 int64_t default_value) const {
839 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 841 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
840 if (iter == prop_map_.end()) 842 if (iter == prop_map_.end())
841 return default_value; 843 return default_value;
842 return iter->second.value; 844 return iter->second.value;
843 } 845 }
844 846
845 } // namespace exo 847 } // namespace exo
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | content/browser/compositor/gpu_process_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698