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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 base::TimeTicks last_used_time) | 32 base::TimeTicks last_used_time) |
33 : surface_id(surface_id), | 33 : surface_id(surface_id), |
34 visible(visible), | 34 visible(visible), |
35 last_used_time(last_used_time) { | 35 last_used_time(last_used_time) { |
36 } | 36 } |
37 | 37 |
38 GpuCommandBufferStub::GpuCommandBufferStub( | 38 GpuCommandBufferStub::GpuCommandBufferStub( |
39 GpuChannel* channel, | 39 GpuChannel* channel, |
40 GpuCommandBufferStub* share_group, | 40 GpuCommandBufferStub* share_group, |
41 const gfx::GLSurfaceHandle& handle, | 41 const gfx::GLSurfaceHandle& handle, |
| 42 gpu::gles2::Display* display, |
42 const gfx::Size& size, | 43 const gfx::Size& size, |
43 const gpu::gles2::DisallowedFeatures& disallowed_features, | 44 const gpu::gles2::DisallowedFeatures& disallowed_features, |
44 const std::string& allowed_extensions, | 45 const std::string& allowed_extensions, |
45 const std::vector<int32>& attribs, | 46 const std::vector<int32>& attribs, |
46 gfx::GpuPreference gpu_preference, | 47 gfx::GpuPreference gpu_preference, |
47 int32 route_id, | 48 int32 route_id, |
48 int32 surface_id, | 49 int32 surface_id, |
49 GpuWatchdog* watchdog, | 50 GpuWatchdog* watchdog, |
50 bool software) | 51 bool software) |
51 : channel_(channel), | 52 : channel_(channel), |
52 handle_(handle), | 53 handle_(handle), |
53 initial_size_(size), | 54 initial_size_(size), |
54 disallowed_features_(disallowed_features), | 55 disallowed_features_(disallowed_features), |
55 allowed_extensions_(allowed_extensions), | 56 allowed_extensions_(allowed_extensions), |
56 requested_attribs_(attribs), | 57 requested_attribs_(attribs), |
57 gpu_preference_(gpu_preference), | 58 gpu_preference_(gpu_preference), |
58 route_id_(route_id), | 59 route_id_(route_id), |
59 software_(software), | 60 software_(software), |
60 last_flush_count_(0), | 61 last_flush_count_(0), |
61 allocation_(GpuMemoryAllocation::INVALID_RESOURCE_SIZE, true, true), | 62 allocation_(GpuMemoryAllocation::INVALID_RESOURCE_SIZE, true, true), |
62 parent_stub_for_initialization_(), | 63 parent_stub_for_initialization_(), |
63 parent_texture_for_initialization_(0), | 64 parent_texture_for_initialization_(0), |
64 watchdog_(watchdog) { | 65 watchdog_(watchdog) { |
65 if (share_group) { | 66 if (share_group) { |
66 context_group_ = share_group->context_group_; | 67 context_group_ = share_group->context_group_; |
67 } else { | 68 } else { |
68 context_group_ = new gpu::gles2::ContextGroup(true); | 69 context_group_ = new gpu::gles2::ContextGroup(display, true); |
69 } | 70 } |
70 if (surface_id != 0) | 71 if (surface_id != 0) |
71 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( | 72 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( |
72 surface_id, true, base::TimeTicks::Now())); | 73 surface_id, true, base::TimeTicks::Now())); |
73 } | 74 } |
74 | 75 |
75 GpuCommandBufferStub::~GpuCommandBufferStub() { | 76 GpuCommandBufferStub::~GpuCommandBufferStub() { |
76 Destroy(); | 77 Destroy(); |
77 | 78 |
78 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 79 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 632 } |
632 | 633 |
633 void GpuCommandBufferStub::SetMemoryAllocation( | 634 void GpuCommandBufferStub::SetMemoryAllocation( |
634 const GpuMemoryAllocation& allocation) { | 635 const GpuMemoryAllocation& allocation) { |
635 allocation_ = allocation; | 636 allocation_ = allocation; |
636 | 637 |
637 SendMemoryAllocationToProxy(allocation); | 638 SendMemoryAllocationToProxy(allocation); |
638 } | 639 } |
639 | 640 |
640 #endif // defined(ENABLE_GPU) | 641 #endif // defined(ENABLE_GPU) |
OLD | NEW |