| 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 #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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |