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

Side by Side Diff: gpu/command_buffer/tests/fuzzer_main.cc

Issue 2767093003: gpu_fuzzer: Destroy the command decoder before the context. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include <stddef.h> 4 #include <stddef.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (!vertex_translator_) { 183 if (!vertex_translator_) {
184 // Keep a reference to the translators, which keeps them in the cache even 184 // Keep a reference to the translators, which keeps them in the cache even
185 // after the decoder is reset. They are expensive to initialize, but they 185 // after the decoder is reset. They are expensive to initialize, but they
186 // don't keep state. 186 // don't keep state.
187 vertex_translator_ = decoder_->GetTranslator(GL_VERTEX_SHADER); 187 vertex_translator_ = decoder_->GetTranslator(GL_VERTEX_SHADER);
188 fragment_translator_ = decoder_->GetTranslator(GL_FRAGMENT_SHADER); 188 fragment_translator_ = decoder_->GetTranslator(GL_FRAGMENT_SHADER);
189 } 189 }
190 } 190 }
191 191
192 void ResetDecoder() { 192 void ResetDecoder() {
193 decoder_->Destroy(true);
194 decoder_.reset();
193 if (recreate_context_) { 195 if (recreate_context_) {
194 context_->ReleaseCurrent(nullptr); 196 context_->ReleaseCurrent(nullptr);
195 context_ = nullptr; 197 context_ = nullptr;
196 } 198 }
197 decoder_->Destroy(true);
198 decoder_.reset();
199 command_buffer_.reset(); 199 command_buffer_.reset();
200 } 200 }
201 201
202 ~CommandBufferSetup() { 202 ~CommandBufferSetup() {
203 if (sync_point_order_data_) { 203 if (sync_point_order_data_) {
204 sync_point_order_data_->Destroy(); 204 sync_point_order_data_->Destroy();
205 sync_point_order_data_ = nullptr; 205 sync_point_order_data_ = nullptr;
206 } 206 }
207 if (sync_point_client_state_) { 207 if (sync_point_client_state_) {
208 sync_point_client_state_->Destroy(); 208 sync_point_client_state_->Destroy();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // registered, causing crashes. 336 // registered, causing crashes.
337 CommandBufferSetup* g_setup = new CommandBufferSetup(); 337 CommandBufferSetup* g_setup = new CommandBufferSetup();
338 338
339 } // anonymous namespace 339 } // anonymous namespace
340 } // namespace gpu 340 } // namespace gpu
341 341
342 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 342 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
343 gpu::g_setup->RunCommandBuffer(data, size); 343 gpu::g_setup->RunCommandBuffer(data, size);
344 return 0; 344 return 0;
345 } 345 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698