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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 10534173: GPU Program Caching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Style fixes, thorough tests Created 8 years, 5 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 (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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const gfx::GLSurfaceHandle& handle, 51 const gfx::GLSurfaceHandle& handle,
52 gpu::gles2::MailboxManager* mailbox_manager, 52 gpu::gles2::MailboxManager* mailbox_manager,
53 const gfx::Size& size, 53 const gfx::Size& size,
54 const gpu::gles2::DisallowedFeatures& disallowed_features, 54 const gpu::gles2::DisallowedFeatures& disallowed_features,
55 const std::string& allowed_extensions, 55 const std::string& allowed_extensions,
56 const std::vector<int32>& attribs, 56 const std::vector<int32>& attribs,
57 gfx::GpuPreference gpu_preference, 57 gfx::GpuPreference gpu_preference,
58 int32 route_id, 58 int32 route_id,
59 int32 surface_id, 59 int32 surface_id,
60 GpuWatchdog* watchdog, 60 GpuWatchdog* watchdog,
61 bool software) 61 bool software,
62 gpu::gles2::ProgramCache* program_cache)
62 : channel_(channel), 63 : channel_(channel),
63 handle_(handle), 64 handle_(handle),
64 initial_size_(size), 65 initial_size_(size),
65 disallowed_features_(disallowed_features), 66 disallowed_features_(disallowed_features),
66 allowed_extensions_(allowed_extensions), 67 allowed_extensions_(allowed_extensions),
67 requested_attribs_(attribs), 68 requested_attribs_(attribs),
68 gpu_preference_(gpu_preference), 69 gpu_preference_(gpu_preference),
69 route_id_(route_id), 70 route_id_(route_id),
70 software_(software), 71 software_(software),
71 client_has_memory_allocation_changed_callback_(false), 72 client_has_memory_allocation_changed_callback_(false),
72 last_flush_count_(0), 73 last_flush_count_(0),
73 parent_stub_for_initialization_(), 74 parent_stub_for_initialization_(),
74 parent_texture_for_initialization_(0), 75 parent_texture_for_initialization_(0),
75 watchdog_(watchdog), 76 watchdog_(watchdog),
76 sync_point_wait_count_(0), 77 sync_point_wait_count_(0),
77 delayed_work_scheduled_(false) { 78 delayed_work_scheduled_(false) {
78 if (share_group) { 79 if (share_group) {
79 context_group_ = share_group->context_group_; 80 context_group_ = share_group->context_group_;
80 } else { 81 } else {
81 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, true); 82 context_group_ = new gpu::gles2::ContextGroup(mailbox_manager,
83 true,
84 program_cache);
82 } 85 }
83 if (surface_id != 0) 86 if (surface_id != 0)
84 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( 87 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState(
85 surface_id, true, base::TimeTicks::Now())); 88 surface_id, true, base::TimeTicks::Now()));
86 if (handle_.sync_point) 89 if (handle_.sync_point)
87 OnWaitSyncPoint(handle_.sync_point); 90 OnWaitSyncPoint(handle_.sync_point);
88 } 91 }
89 92
90 GpuCommandBufferStub::~GpuCommandBufferStub() { 93 GpuCommandBufferStub::~GpuCommandBufferStub() {
91 Destroy(); 94 Destroy();
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 const GpuMemoryAllocation& allocation) { 768 const GpuMemoryAllocation& allocation) {
766 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 769 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
767 // This can be called outside of OnMessageReceived, so the context needs to be 770 // This can be called outside of OnMessageReceived, so the context needs to be
768 // made current before calling methods on the surface. 771 // made current before calling methods on the surface.
769 if (!surface_ || !MakeCurrent()) 772 if (!surface_ || !MakeCurrent())
770 return; 773 return;
771 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); 774 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer);
772 } 775 }
773 776
774 #endif // defined(ENABLE_GPU) 777 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698