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

Side by Side Diff: cc/output/output_surface.cc

Issue 889063002: (not for commit) Create 2nd ContextProvider for Ganesh rasterization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « cc/output/output_surface.h ('k') | cc/output/output_surface_unittest.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/output/managed_memory_policy.h" 10 #include "cc/output/managed_memory_policy.h"
11 #include "cc/output/output_surface_client.h" 11 #include "cc/output/output_surface_client.h"
12 #include "gpu/GLES2/gl2extchromium.h" 12 #include "gpu/GLES2/gl2extchromium.h"
13 #include "gpu/command_buffer/client/gles2_interface.h" 13 #include "gpu/command_buffer/client/gles2_interface.h"
14 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 17
18 namespace cc { 18 namespace cc {
19 19
20 OutputSurface::OutputSurface( 20 OutputSurface::OutputSurface(
21 const scoped_refptr<ContextProvider>& context_provider) 21 const scoped_refptr<ContextProvider>& context_provider)
22 : client_(NULL), 22 : client_(NULL),
23 context_provider_(context_provider), 23 context_provider_(context_provider),
24 worker_context_provider_(NULL),
24 device_scale_factor_(-1), 25 device_scale_factor_(-1),
25 external_stencil_test_enabled_(false), 26 external_stencil_test_enabled_(false),
26 weak_ptr_factory_(this) { 27 weak_ptr_factory_(this) {
28 }
29
30 OutputSurface::OutputSurface(
31 const scoped_refptr<ContextProvider>& context_provider,
32 const scoped_refptr<ContextProvider>& worker_context_provider)
33 : client_(NULL),
34 context_provider_(context_provider),
35 worker_context_provider_(worker_context_provider),
36 device_scale_factor_(-1),
37 external_stencil_test_enabled_(false),
38 weak_ptr_factory_(this) {
27 } 39 }
28 40
29 OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) 41 OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device)
30 : client_(NULL), 42 : client_(NULL),
31 software_device_(software_device.Pass()), 43 software_device_(software_device.Pass()),
32 device_scale_factor_(-1), 44 device_scale_factor_(-1),
33 external_stencil_test_enabled_(false), 45 external_stencil_test_enabled_(false),
34 weak_ptr_factory_(this) { 46 weak_ptr_factory_(this) {
35 } 47 }
36 48
37 OutputSurface::OutputSurface( 49 OutputSurface::OutputSurface(
38 const scoped_refptr<ContextProvider>& context_provider, 50 const scoped_refptr<ContextProvider>& context_provider,
51 const scoped_refptr<ContextProvider>& worker_context_provider,
39 scoped_ptr<SoftwareOutputDevice> software_device) 52 scoped_ptr<SoftwareOutputDevice> software_device)
40 : client_(NULL), 53 : client_(NULL),
41 context_provider_(context_provider), 54 context_provider_(context_provider),
55 worker_context_provider_(worker_context_provider),
42 software_device_(software_device.Pass()), 56 software_device_(software_device.Pass()),
43 device_scale_factor_(-1), 57 device_scale_factor_(-1),
44 external_stencil_test_enabled_(false), 58 external_stencil_test_enabled_(false),
45 weak_ptr_factory_(this) { 59 weak_ptr_factory_(this) {
46 } 60 }
47 61
48 void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase, 62 void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase,
49 base::TimeDelta interval) { 63 base::TimeDelta interval) {
50 TRACE_EVENT2("cc", 64 TRACE_EVENT2("cc",
51 "OutputSurface::CommitVSyncParameters", 65 "OutputSurface::CommitVSyncParameters",
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return external_stencil_test_enabled_; 112 return external_stencil_test_enabled_;
99 } 113 }
100 114
101 bool OutputSurface::BindToClient(OutputSurfaceClient* client) { 115 bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
102 DCHECK(client); 116 DCHECK(client);
103 client_ = client; 117 client_ = client;
104 bool success = true; 118 bool success = true;
105 119
106 if (context_provider_.get()) { 120 if (context_provider_.get()) {
107 success = context_provider_->BindToCurrentThread(); 121 success = context_provider_->BindToCurrentThread();
108 if (success) 122 if (success) {
109 SetUpContext3d(); 123 SetUpContext3d();
124 }
125 }
126
127 if (worker_context_provider_.get()) {
128 success = worker_context_provider_->BindToCurrentThread();
129 // TODO(vmiura): Callbacks for worker context.
110 } 130 }
111 131
112 if (!success) 132 if (!success)
113 client_ = NULL; 133 client_ = NULL;
114 134
115 return success; 135 return success;
116 } 136 }
117 137
118 bool OutputSurface::InitializeAndSetContext3d( 138 bool OutputSurface::InitializeAndSetContext3d(
119 scoped_refptr<ContextProvider> context_provider) { 139 scoped_refptr<ContextProvider> context_provider) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", 242 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy",
223 "bytes_limit_when_visible", policy.bytes_limit_when_visible); 243 "bytes_limit_when_visible", policy.bytes_limit_when_visible);
224 // Just ignore the memory manager when it says to set the limit to zero 244 // Just ignore the memory manager when it says to set the limit to zero
225 // bytes. This will happen when the memory manager thinks that the renderer 245 // bytes. This will happen when the memory manager thinks that the renderer
226 // is not visible (which the renderer knows better). 246 // is not visible (which the renderer knows better).
227 if (policy.bytes_limit_when_visible) 247 if (policy.bytes_limit_when_visible)
228 client_->SetMemoryPolicy(policy); 248 client_->SetMemoryPolicy(policy);
229 } 249 }
230 250
231 } // namespace cc 251 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/output/output_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698