OLD | NEW |
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 "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_channel_manager.h" | 10 #include "content/common/gpu/gpu_channel_manager.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 bool ImageTransportSurfaceAndroid::Initialize() { | 86 bool ImageTransportSurfaceAndroid::Initialize() { |
87 if (!surface()) | 87 if (!surface()) |
88 return false; | 88 return false; |
89 | 89 |
90 if (!PassThroughImageTransportSurface::Initialize()) | 90 if (!PassThroughImageTransportSurface::Initialize()) |
91 return false; | 91 return false; |
92 | 92 |
93 GpuChannel* parent_channel = | 93 GpuChannel* parent_channel = |
94 GetHelper()->manager()->LookupChannel(parent_client_id_); | 94 GetHelper()->manager()->LookupChannel(parent_client_id_); |
95 if (parent_channel) | 95 if (parent_channel) { |
96 GetHelper()->SetPreemptByFlag(parent_channel->GetPreemptionFlag()); | 96 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 97 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) |
| 98 GetHelper()->SetPreemptByFlag(parent_channel->GetPreemptionFlag()); |
| 99 } |
97 | 100 |
98 return true; | 101 return true; |
99 } | 102 } |
100 | 103 |
101 bool ImageTransportSurfaceAndroid::OnMakeCurrent(gfx::GLContext* context) { | 104 bool ImageTransportSurfaceAndroid::OnMakeCurrent(gfx::GLContext* context) { |
102 DidAccessGpu(); | 105 DidAccessGpu(); |
103 return PassThroughImageTransportSurface::OnMakeCurrent(context); | 106 return PassThroughImageTransportSurface::OnMakeCurrent(context); |
104 } | 107 } |
105 | 108 |
106 bool ImageTransportSurfaceAndroid::SwapBuffers() { | 109 bool ImageTransportSurfaceAndroid::SwapBuffers() { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if (window) | 185 if (window) |
183 ANativeWindow_release(window); | 186 ANativeWindow_release(window); |
184 if (!initialize_success) | 187 if (!initialize_success) |
185 return scoped_refptr<gfx::GLSurface>(); | 188 return scoped_refptr<gfx::GLSurface>(); |
186 | 189 |
187 return scoped_refptr<gfx::GLSurface>( | 190 return scoped_refptr<gfx::GLSurface>( |
188 new DirectSurfaceAndroid(manager, stub, surface.get(), false)); | 191 new DirectSurfaceAndroid(manager, stub, surface.get(), false)); |
189 } | 192 } |
190 | 193 |
191 } // namespace content | 194 } // namespace content |
OLD | NEW |