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

Side by Side Diff: ui/gl/gl_context.cc

Issue 898543002: Remove GLFence::CreateWithoutFlush (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove flush event Created 5 years, 10 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 | « ui/gl/gl_context.h ('k') | ui/gl/gl_fence.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 20 matching lines...) Expand all
31 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { 31 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() {
32 if (!canceled_ && GetCurrent()) { 32 if (!canceled_ && GetCurrent()) {
33 GetCurrent()->ReleaseCurrent(NULL); 33 GetCurrent()->ReleaseCurrent(NULL);
34 } 34 }
35 } 35 }
36 36
37 void GLContext::ScopedReleaseCurrent::Cancel() { 37 void GLContext::ScopedReleaseCurrent::Cancel() {
38 canceled_ = true; 38 canceled_ = true;
39 } 39 }
40 40
41 GLContext::FlushEvent::FlushEvent() {
42 }
43
44 GLContext::FlushEvent::~FlushEvent() {
45 }
46
47 void GLContext::FlushEvent::Signal() {
48 flag_.Set();
49 }
50
51 bool GLContext::FlushEvent::IsSignaled() {
52 return flag_.IsSet();
53 }
54
55 GLContext::GLContext(GLShareGroup* share_group) : 41 GLContext::GLContext(GLShareGroup* share_group) :
56 share_group_(share_group), 42 share_group_(share_group),
57 swap_interval_(1), 43 swap_interval_(1),
58 force_swap_interval_zero_(false) { 44 force_swap_interval_zero_(false) {
59 if (!share_group_.get()) 45 if (!share_group_.get())
60 share_group_ = new GLShareGroup; 46 share_group_ = new GLShareGroup;
61 47
62 share_group_->AddContext(this); 48 share_group_->AddContext(this);
63 } 49 }
64 50
65 GLContext::~GLContext() { 51 GLContext::~GLContext() {
66 share_group_->RemoveContext(this); 52 share_group_->RemoveContext(this);
67 if (GetCurrent() == this) { 53 if (GetCurrent() == this) {
68 SetCurrent(NULL); 54 SetCurrent(NULL);
69 } 55 }
70 } 56 }
71 57
72 scoped_refptr<GLContext::FlushEvent> GLContext::SignalFlush() {
73 DCHECK(IsCurrent(NULL));
74 scoped_refptr<FlushEvent> flush_event = new FlushEvent();
75 flush_events_.push_back(flush_event);
76 return flush_event;
77 }
78
79 bool GLContext::GetTotalGpuMemory(size_t* bytes) { 58 bool GLContext::GetTotalGpuMemory(size_t* bytes) {
80 DCHECK(bytes); 59 DCHECK(bytes);
81 *bytes = 0; 60 *bytes = 0;
82 return false; 61 return false;
83 } 62 }
84 63
85 void GLContext::SetSafeToForceGpuSwitch() { 64 void GLContext::SetSafeToForceGpuSwitch() {
86 } 65 }
87 66
88 bool GLContext::ForceGpuSwitchIfNeeded() { 67 bool GLContext::ForceGpuSwitchIfNeeded() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 202
224 void GLContext::OnReleaseVirtuallyCurrent(GLContext* virtual_context) { 203 void GLContext::OnReleaseVirtuallyCurrent(GLContext* virtual_context) {
225 if (virtual_gl_api_) 204 if (virtual_gl_api_)
226 virtual_gl_api_->OnReleaseVirtuallyCurrent(virtual_context); 205 virtual_gl_api_->OnReleaseVirtuallyCurrent(virtual_context);
227 } 206 }
228 207
229 void GLContext::SetRealGLApi() { 208 void GLContext::SetRealGLApi() {
230 SetGLToRealGLApi(); 209 SetGLToRealGLApi();
231 } 210 }
232 211
233 void GLContext::OnFlush() {
234 for (size_t n = 0; n < flush_events_.size(); n++)
235 flush_events_[n]->Signal();
236 flush_events_.clear();
237 }
238
239 GLContextReal::GLContextReal(GLShareGroup* share_group) 212 GLContextReal::GLContextReal(GLShareGroup* share_group)
240 : GLContext(share_group) {} 213 : GLContext(share_group) {}
241 214
242 GLContextReal::~GLContextReal() {} 215 GLContextReal::~GLContextReal() {}
243 216
244 void GLContextReal::SetCurrent(GLSurface* surface) { 217 void GLContextReal::SetCurrent(GLSurface* surface) {
245 GLContext::SetCurrent(surface); 218 GLContext::SetCurrent(surface);
246 current_real_context_.Pointer()->Set(surface ? this : NULL); 219 current_real_context_.Pointer()->Set(surface ? this : NULL);
247 } 220 }
248 221
249 } // namespace gfx 222 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_fence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698