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

Side by Side Diff: gpu/command_buffer/service/program_manager.cc

Issue 2372593003: Iterative cleanup for GL programs in GPU process (Closed)
Patch Set: fix build Created 4 years, 2 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/command_buffer/service/program_manager.h ('k') | gpu/ipc/service/gpu_channel.h » ('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/command_buffer/service/program_manager.h" 5 #include "gpu/command_buffer/service/program_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 } 2475 }
2476 2476
2477 void ProgramManager::Destroy(bool have_context) { 2477 void ProgramManager::Destroy(bool have_context) {
2478 have_context_ = have_context; 2478 have_context_ = have_context;
2479 2479
2480 ProgramDeletionScopedUmaTimeAndRate scoped_histogram( 2480 ProgramDeletionScopedUmaTimeAndRate scoped_histogram(
2481 base::saturated_cast<int32_t>(programs_.size())); 2481 base::saturated_cast<int32_t>(programs_.size()));
2482 programs_.clear(); 2482 programs_.clear();
2483 } 2483 }
2484 2484
2485 bool ProgramManager::PreDestroyWithTimeout(bool have_context,
2486 const base::TimeTicks& timeout) {
2487 have_context_ = have_context;
2488 for (auto it = programs_.begin(); it != programs_.end();) {
2489 if (it->second->InUse()) {
2490 // Can't delete in-use programs.
2491 ++it;
2492 continue;
2493 }
2494 if (base::TimeTicks::Now() > timeout)
2495 return false;
2496
2497 it = programs_.erase(it);
2498 }
2499 return true;
2500 }
2501
2485 void ProgramManager::StartTracking(Program* /* program */) { 2502 void ProgramManager::StartTracking(Program* /* program */) {
2486 ++program_count_; 2503 ++program_count_;
2487 } 2504 }
2488 2505
2489 void ProgramManager::StopTracking(Program* /* program */) { 2506 void ProgramManager::StopTracking(Program* /* program */) {
2490 --program_count_; 2507 --program_count_;
2491 } 2508 }
2492 2509
2493 Program* ProgramManager::CreateProgram( 2510 Program* ProgramManager::CreateProgram(
2494 GLuint client_id, GLuint service_id) { 2511 GLuint client_id, GLuint service_id) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 DCHECK(program); 2595 DCHECK(program);
2579 program->ClearUniforms(&zero_); 2596 program->ClearUniforms(&zero_);
2580 } 2597 }
2581 2598
2582 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { 2599 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) {
2583 return index + element * 0x10000; 2600 return index + element * 0x10000;
2584 } 2601 }
2585 2602
2586 } // namespace gles2 2603 } // namespace gles2
2587 } // namespace gpu 2604 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager.h ('k') | gpu/ipc/service/gpu_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698