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

Side by Side Diff: gpu/ipc/service/gpu_channel_manager.cc

Issue 2744363002: Clear shader disk cache after glProgramBinary failure. (Closed)
Patch Set: Remove singleton and clean up init Created 3 years, 9 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 | « gpu/ipc/service/gpu_channel_manager.h ('k') | gpu/ipc/service/gpu_channel_test_common.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) 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 "gpu/ipc/service/gpu_channel_manager.h" 5 #include "gpu/ipc/service/gpu_channel_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 GpuChannelManager::GpuChannelManager( 46 GpuChannelManager::GpuChannelManager(
47 const GpuPreferences& gpu_preferences, 47 const GpuPreferences& gpu_preferences,
48 GpuChannelManagerDelegate* delegate, 48 GpuChannelManagerDelegate* delegate,
49 GpuWatchdogThread* watchdog, 49 GpuWatchdogThread* watchdog,
50 base::SingleThreadTaskRunner* task_runner, 50 base::SingleThreadTaskRunner* task_runner,
51 base::SingleThreadTaskRunner* io_task_runner, 51 base::SingleThreadTaskRunner* io_task_runner,
52 base::WaitableEvent* shutdown_event, 52 base::WaitableEvent* shutdown_event,
53 SyncPointManager* sync_point_manager, 53 SyncPointManager* sync_point_manager,
54 GpuMemoryBufferFactory* gpu_memory_buffer_factory, 54 GpuMemoryBufferFactory* gpu_memory_buffer_factory,
55 const GpuFeatureInfo& gpu_feature_info) 55 const GpuFeatureInfo& gpu_feature_info,
56 GpuProcessActivityFlags activity_flags)
56 : task_runner_(task_runner), 57 : task_runner_(task_runner),
57 io_task_runner_(io_task_runner), 58 io_task_runner_(io_task_runner),
58 gpu_preferences_(gpu_preferences), 59 gpu_preferences_(gpu_preferences),
59 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), 60 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()),
60 delegate_(delegate), 61 delegate_(delegate),
61 watchdog_(watchdog), 62 watchdog_(watchdog),
62 shutdown_event_(shutdown_event), 63 shutdown_event_(shutdown_event),
63 share_group_(new gl::GLShareGroup()), 64 share_group_(new gl::GLShareGroup()),
64 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)), 65 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)),
65 gpu_memory_manager_(this), 66 gpu_memory_manager_(this),
66 sync_point_manager_(sync_point_manager), 67 sync_point_manager_(sync_point_manager),
67 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), 68 gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
68 gpu_feature_info_(gpu_feature_info), 69 gpu_feature_info_(gpu_feature_info),
69 exiting_for_lost_context_(false), 70 exiting_for_lost_context_(false),
71 activity_flags_(std::move(activity_flags)),
70 weak_factory_(this) { 72 weak_factory_(this) {
71 DCHECK(task_runner); 73 DCHECK(task_runner);
72 DCHECK(io_task_runner); 74 DCHECK(io_task_runner);
73 if (gpu_preferences_.ui_prioritize_in_gpu_process) 75 if (gpu_preferences_.ui_prioritize_in_gpu_process)
74 preemption_flag_ = new PreemptionFlag; 76 preemption_flag_ = new PreemptionFlag;
75 } 77 }
76 78
77 GpuChannelManager::~GpuChannelManager() { 79 GpuChannelManager::~GpuChannelManager() {
78 // Destroy channels before anything else because of dependencies. 80 // Destroy channels before anything else because of dependencies.
79 gpu_channels_.clear(); 81 gpu_channels_.clear();
80 if (default_offscreen_surface_.get()) { 82 if (default_offscreen_surface_.get()) {
81 default_offscreen_surface_->Destroy(); 83 default_offscreen_surface_->Destroy();
82 default_offscreen_surface_ = NULL; 84 default_offscreen_surface_ = NULL;
83 } 85 }
84 } 86 }
85 87
86 gles2::ProgramCache* GpuChannelManager::program_cache() { 88 gles2::ProgramCache* GpuChannelManager::program_cache() {
87 if (!program_cache_.get() && 89 if (!program_cache_.get() &&
88 !gpu_preferences_.disable_gpu_program_cache) { 90 !gpu_preferences_.disable_gpu_program_cache) {
89 const GpuDriverBugWorkarounds& workarounds = gpu_driver_bug_workarounds_; 91 const GpuDriverBugWorkarounds& workarounds = gpu_driver_bug_workarounds_;
90 bool disable_disk_cache = 92 bool disable_disk_cache =
91 gpu_preferences_.disable_gpu_shader_disk_cache || 93 gpu_preferences_.disable_gpu_shader_disk_cache ||
92 workarounds.disable_program_disk_cache; 94 workarounds.disable_program_disk_cache;
93 program_cache_.reset(new gles2::MemoryProgramCache( 95 program_cache_.reset(new gles2::MemoryProgramCache(
94 gpu_preferences_.gpu_program_cache_size, 96 gpu_preferences_.gpu_program_cache_size, disable_disk_cache,
95 disable_disk_cache, 97 workarounds.disable_program_caching_for_transform_feedback,
96 workarounds.disable_program_caching_for_transform_feedback)); 98 &activity_flags_));
97 } 99 }
98 return program_cache_.get(); 100 return program_cache_.get();
99 } 101 }
100 102
101 gles2::ShaderTranslatorCache* 103 gles2::ShaderTranslatorCache*
102 GpuChannelManager::shader_translator_cache() { 104 GpuChannelManager::shader_translator_cache() {
103 if (!shader_translator_cache_.get()) { 105 if (!shader_translator_cache_.get()) {
104 shader_translator_cache_ = 106 shader_translator_cache_ =
105 new gles2::ShaderTranslatorCache(gpu_preferences_); 107 new gles2::ShaderTranslatorCache(gpu_preferences_);
106 } 108 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 279 }
278 } 280 }
279 if (!stub || !stub->decoder()->MakeCurrent()) 281 if (!stub || !stub->decoder()->MakeCurrent())
280 return; 282 return;
281 glFinish(); 283 glFinish();
282 DidAccessGpu(); 284 DidAccessGpu();
283 } 285 }
284 #endif 286 #endif
285 287
286 } // namespace gpu 288 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel_manager.h ('k') | gpu/ipc/service/gpu_channel_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698