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

Side by Side Diff: services/ui/surfaces/surfaces_context_provider.cc

Issue 2278283003: Refactor client visibility handling (Closed)
Patch Set: more fixes Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/surfaces/surfaces_context_provider.h" 5 #include "services/ui/surfaces/surfaces_context_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "cc/output/context_cache_controller.h"
15 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 16 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
16 #include "gpu/command_buffer/client/gles2_implementation.h" 17 #include "gpu/command_buffer/client/gles2_implementation.h"
17 #include "gpu/command_buffer/client/shared_memory_limits.h" 18 #include "gpu/command_buffer/client/shared_memory_limits.h"
18 #include "gpu/command_buffer/client/transfer_buffer.h" 19 #include "gpu/command_buffer/client/transfer_buffer.h"
19 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 20 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
20 #include "gpu/ipc/client/gpu_channel_host.h" 21 #include "gpu/ipc/client/gpu_channel_host.h"
21 #include "services/ui/common/switches.h" 22 #include "services/ui/common/switches.h"
22 #include "services/ui/surfaces/surfaces_context_provider_delegate.h" 23 #include "services/ui/surfaces/surfaces_context_provider_delegate.h"
23 #include "ui/gl/gpu_preference.h" 24 #include "ui/gl/gpu_preference.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 bool bind_generates_resource = 86 bool bind_generates_resource =
86 !!capabilities_.bind_generates_resource_chromium; 87 !!capabilities_.bind_generates_resource_chromium;
87 // TODO(piman): Some contexts (such as compositor) want this to be true, so 88 // TODO(piman): Some contexts (such as compositor) want this to be true, so
88 // this needs to be a public parameter. 89 // this needs to be a public parameter.
89 bool lose_context_when_out_of_memory = false; 90 bool lose_context_when_out_of_memory = false;
90 bool support_client_side_arrays = false; 91 bool support_client_side_arrays = false;
91 implementation_.reset(new gpu::gles2::GLES2Implementation( 92 implementation_.reset(new gpu::gles2::GLES2Implementation(
92 gles2_helper_.get(), NULL, transfer_buffer_.get(), 93 gles2_helper_.get(), NULL, transfer_buffer_.get(),
93 bind_generates_resource, lose_context_when_out_of_memory, 94 bind_generates_resource, lose_context_when_out_of_memory,
94 support_client_side_arrays, gpu_control)); 95 support_client_side_arrays, gpu_control));
96 cache_controller_.reset(
97 new cc::ContextCacheController(implementation_.get()));
95 return implementation_->Initialize( 98 return implementation_->Initialize(
96 default_limits.start_transfer_buffer_size, 99 default_limits.start_transfer_buffer_size,
97 default_limits.min_transfer_buffer_size, 100 default_limits.min_transfer_buffer_size,
98 default_limits.max_transfer_buffer_size, 101 default_limits.max_transfer_buffer_size,
99 default_limits.mapped_memory_reclaim_limit); 102 default_limits.mapped_memory_reclaim_limit);
100 } 103 }
101 104
102 gpu::gles2::GLES2Interface* SurfacesContextProvider::ContextGL() { 105 gpu::gles2::GLES2Interface* SurfacesContextProvider::ContextGL() {
103 DCHECK(implementation_); 106 DCHECK(implementation_);
104 return implementation_.get(); 107 return implementation_.get();
105 } 108 }
106 109
107 gpu::ContextSupport* SurfacesContextProvider::ContextSupport() { 110 gpu::ContextSupport* SurfacesContextProvider::ContextSupport() {
108 return implementation_.get(); 111 return implementation_.get();
109 } 112 }
110 113
111 class GrContext* SurfacesContextProvider::GrContext() { 114 class GrContext* SurfacesContextProvider::GrContext() {
112 return NULL; 115 return NULL;
113 } 116 }
114 117
118 cc::ContextCacheController* SurfacesContextProvider::CacheController() {
119 return cache_controller_.get();
120 }
121
115 void SurfacesContextProvider::InvalidateGrContext(uint32_t state) {} 122 void SurfacesContextProvider::InvalidateGrContext(uint32_t state) {}
116 123
117 gpu::Capabilities SurfacesContextProvider::ContextCapabilities() { 124 gpu::Capabilities SurfacesContextProvider::ContextCapabilities() {
118 return capabilities_; 125 return capabilities_;
119 } 126 }
120 127
121 base::Lock* SurfacesContextProvider::GetLock() { 128 base::Lock* SurfacesContextProvider::GetLock() {
122 // This context provider is not used on multiple threads. 129 // This context provider is not used on multiple threads.
123 NOTREACHED(); 130 NOTREACHED();
124 return nullptr; 131 return nullptr;
(...skipping 27 matching lines...) Expand all
152 if (delegate_) 159 if (delegate_)
153 delegate_->OnVSyncParametersUpdated(timebase, interval); 160 delegate_->OnVSyncParametersUpdated(timebase, interval);
154 } 161 }
155 162
156 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( 163 void SurfacesContextProvider::SetSwapBuffersCompletionCallback(
157 gl::GLSurface::SwapCompletionCallback callback) { 164 gl::GLSurface::SwapCompletionCallback callback) {
158 swap_buffers_completion_callback_ = callback; 165 swap_buffers_completion_callback_ = callback;
159 } 166 }
160 167
161 } // namespace ui 168 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/surfaces_context_provider.h ('k') | ui/compositor/test/in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698