OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 namespace cc { | 50 namespace cc { |
51 namespace { | 51 namespace { |
52 | 52 |
53 class FallbackFence : public ResourceProvider::Fence { | 53 class FallbackFence : public ResourceProvider::Fence { |
54 public: | 54 public: |
55 explicit FallbackFence(gpu::gles2::GLES2Interface* gl) | 55 explicit FallbackFence(gpu::gles2::GLES2Interface* gl) |
56 : gl_(gl), has_passed_(true) {} | 56 : gl_(gl), has_passed_(true) {} |
57 | 57 |
58 // Overridden from ResourceProvider::Fence: | 58 // Overridden from ResourceProvider::Fence: |
59 virtual void Set() override { has_passed_ = false; } | 59 void Set() override { has_passed_ = false; } |
60 virtual bool HasPassed() override { | 60 bool HasPassed() override { |
61 if (!has_passed_) { | 61 if (!has_passed_) { |
62 has_passed_ = true; | 62 has_passed_ = true; |
63 Synchronize(); | 63 Synchronize(); |
64 } | 64 } |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 virtual ~FallbackFence() {} | 69 ~FallbackFence() override {} |
70 | 70 |
71 void Synchronize() { | 71 void Synchronize() { |
72 TRACE_EVENT0("cc", "FallbackFence::Synchronize"); | 72 TRACE_EVENT0("cc", "FallbackFence::Synchronize"); |
73 gl_->Finish(); | 73 gl_->Finish(); |
74 } | 74 } |
75 | 75 |
76 gpu::gles2::GLES2Interface* gl_; | 76 gpu::gles2::GLES2Interface* gl_; |
77 bool has_passed_; | 77 bool has_passed_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(FallbackFence); | 79 DISALLOW_COPY_AND_ASSIGN(FallbackFence); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 is_pending_ = false; | 244 is_pending_ = false; |
245 } | 245 } |
246 | 246 |
247 private: | 247 private: |
248 class Fence : public ResourceProvider::Fence { | 248 class Fence : public ResourceProvider::Fence { |
249 public: | 249 public: |
250 explicit Fence(base::WeakPtr<GLRenderer::SyncQuery> query) | 250 explicit Fence(base::WeakPtr<GLRenderer::SyncQuery> query) |
251 : query_(query) {} | 251 : query_(query) {} |
252 | 252 |
253 // Overridden from ResourceProvider::Fence: | 253 // Overridden from ResourceProvider::Fence: |
254 virtual void Set() override { | 254 void Set() override { |
255 DCHECK(query_); | 255 DCHECK(query_); |
256 query_->Set(); | 256 query_->Set(); |
257 } | 257 } |
258 virtual bool HasPassed() override { | 258 bool HasPassed() override { return !query_ || !query_->IsPending(); } |
259 return !query_ || !query_->IsPending(); | |
260 } | |
261 | 259 |
262 private: | 260 private: |
263 virtual ~Fence() {} | 261 ~Fence() override {} |
264 | 262 |
265 base::WeakPtr<SyncQuery> query_; | 263 base::WeakPtr<SyncQuery> query_; |
266 | 264 |
267 DISALLOW_COPY_AND_ASSIGN(Fence); | 265 DISALLOW_COPY_AND_ASSIGN(Fence); |
268 }; | 266 }; |
269 | 267 |
270 gpu::gles2::GLES2Interface* gl_; | 268 gpu::gles2::GLES2Interface* gl_; |
271 unsigned query_id_; | 269 unsigned query_id_; |
272 bool is_pending_; | 270 bool is_pending_; |
273 base::WeakPtrFactory<SyncQuery> weak_ptr_factory_; | 271 base::WeakPtrFactory<SyncQuery> weak_ptr_factory_; |
(...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3275 context_support_->ScheduleOverlayPlane( | 3273 context_support_->ScheduleOverlayPlane( |
3276 overlay.plane_z_order, | 3274 overlay.plane_z_order, |
3277 overlay.transform, | 3275 overlay.transform, |
3278 pending_overlay_resources_.back()->texture_id(), | 3276 pending_overlay_resources_.back()->texture_id(), |
3279 overlay.display_rect, | 3277 overlay.display_rect, |
3280 overlay.uv_rect); | 3278 overlay.uv_rect); |
3281 } | 3279 } |
3282 } | 3280 } |
3283 | 3281 |
3284 } // namespace cc | 3282 } // namespace cc |
OLD | NEW |