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

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

Issue 2102123002: Make Satisfy/Require callbacks pass Surface id and sequence by reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More 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
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 aura::Window::ConvertPointToTarget(window->parent(), window, 135 aura::Window::ConvertPointToTarget(window->parent(), window,
136 &local_point); 136 &local_point);
137 return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1))); 137 return surface->HitTestRect(gfx::Rect(local_point, gfx::Size(1, 1)));
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 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.id_namespace, &sequences); 148 manager->DidSatisfySequences(sequence.id_namespace, &sequences);
149 } 149 }
150 150
151 void RequireCallback(cc::SurfaceManager* manager, 151 void RequireCallback(cc::SurfaceManager* manager,
152 cc::SurfaceId id, 152 const cc::SurfaceId& id,
153 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 }
159 surface->AddDestructionDependency(sequence); 159 surface->AddDestructionDependency(sequence);
160 } 160 }
161 161
162 } // namespace 162 } // namespace
163 163
164 //////////////////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////////////////
165 // SurfaceFactoryOwner, public: 165 // SurfaceFactoryOwner, public:
166 166
167 SurfaceFactoryOwner::SurfaceFactoryOwner() {} 167 SurfaceFactoryOwner::SurfaceFactoryOwner() {}
168 168
169 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
170 // cc::SurfaceFactoryClient overrides: 170 // cc::SurfaceFactoryClient overrides:
171 171
172 void SurfaceFactoryOwner::ReturnResources( 172 void SurfaceFactoryOwner::ReturnResources(
173 const cc::ReturnedResourceArray& resources) { 173 const cc::ReturnedResourceArray& resources) {
174 scoped_refptr<SurfaceFactoryOwner> holder(this); 174 scoped_refptr<SurfaceFactoryOwner> holder(this);
175 for (auto& resource : resources) { 175 for (auto& resource : resources) {
176 auto it = release_callbacks_.find(resource.id); 176 auto it = release_callbacks_.find(resource.id);
177 DCHECK(it != release_callbacks_.end()); 177 DCHECK(it != release_callbacks_.end());
178 it->second.second->Run(resource.sync_token, resource.lost); 178 it->second.second->Run(resource.sync_token, resource.lost);
179 release_callbacks_.erase(it); 179 release_callbacks_.erase(it);
180 } 180 }
181 } 181 }
182 182
183 void SurfaceFactoryOwner::WillDrawSurface(cc::SurfaceId id, 183 void SurfaceFactoryOwner::WillDrawSurface(const cc::SurfaceId& id,
184 const gfx::Rect& damage_rect) { 184 const gfx::Rect& damage_rect) {
185 if (surface_) 185 if (surface_)
186 surface_->WillDraw(id); 186 surface_->WillDraw(id);
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:
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 int64_t Surface::GetPropertyInternal(const void* key, 836 int64_t Surface::GetPropertyInternal(const void* key,
837 int64_t default_value) const { 837 int64_t default_value) const {
838 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 838 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
839 if (iter == prop_map_.end()) 839 if (iter == prop_map_.end())
840 return default_value; 840 return default_value;
841 return iter->second.value; 841 return iter->second.value;
842 } 842 }
843 843
844 } // namespace exo 844 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698