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 10 matching lines...) Expand all Loading... | |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 25 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
27 #include "gpu/command_buffer/service/feature_info.h" | 27 #include "gpu/command_buffer/service/feature_info.h" |
28 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 28 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
29 #include "gpu/command_buffer/service/gpu_preferences.h" | 29 #include "gpu/command_buffer/service/gpu_preferences.h" |
30 #include "gpu/command_buffer/service/program_cache.h" | 30 #include "gpu/command_buffer/service/program_cache.h" |
31 #include "gpu/command_buffer/service/progress_reporter.h" | |
31 #include "gpu/command_buffer/service/shader_manager.h" | 32 #include "gpu/command_buffer/service/shader_manager.h" |
32 #include "third_party/re2/src/re2/re2.h" | 33 #include "third_party/re2/src/re2/re2.h" |
33 #include "ui/gl/gl_version_info.h" | 34 #include "ui/gl/gl_version_info.h" |
34 | 35 |
35 using base::TimeDelta; | 36 using base::TimeDelta; |
36 using base::TimeTicks; | 37 using base::TimeTicks; |
37 | 38 |
38 namespace gpu { | 39 namespace gpu { |
39 namespace gles2 { | 40 namespace gles2 { |
40 | 41 |
(...skipping 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2467 max_draw_buffers_(max_draw_buffers), | 2468 max_draw_buffers_(max_draw_buffers), |
2468 max_dual_source_draw_buffers_(max_dual_source_draw_buffers), | 2469 max_dual_source_draw_buffers_(max_dual_source_draw_buffers), |
2469 max_vertex_attribs_(max_vertex_attribs), | 2470 max_vertex_attribs_(max_vertex_attribs), |
2470 gpu_preferences_(gpu_preferences), | 2471 gpu_preferences_(gpu_preferences), |
2471 feature_info_(feature_info) {} | 2472 feature_info_(feature_info) {} |
2472 | 2473 |
2473 ProgramManager::~ProgramManager() { | 2474 ProgramManager::~ProgramManager() { |
2474 DCHECK(programs_.empty()); | 2475 DCHECK(programs_.empty()); |
2475 } | 2476 } |
2476 | 2477 |
2477 void ProgramManager::Destroy(bool have_context) { | 2478 void ProgramManager::Destroy(bool have_context, |
2479 ProgressReporter* progress_reporter) { | |
2478 have_context_ = have_context; | 2480 have_context_ = have_context; |
2479 | 2481 |
2480 ProgramDeletionScopedUmaTimeAndRate scoped_histogram( | 2482 ProgramDeletionScopedUmaTimeAndRate scoped_histogram( |
2481 base::saturated_cast<int32_t>(programs_.size())); | 2483 base::saturated_cast<int32_t>(programs_.size())); |
2482 programs_.clear(); | 2484 while (!programs_.empty()) { |
2485 programs_.erase(programs_.begin()); | |
2486 if (progress_reporter) | |
danakj
2016/10/05 01:53:48
same, when is it null?
ericrk
2016/10/05 18:07:31
refactored/removed.
| |
2487 progress_reporter->ReportProgress(); | |
2488 } | |
2483 } | 2489 } |
2484 | 2490 |
2485 void ProgramManager::StartTracking(Program* /* program */) { | 2491 void ProgramManager::StartTracking(Program* /* program */) { |
2486 ++program_count_; | 2492 ++program_count_; |
2487 } | 2493 } |
2488 | 2494 |
2489 void ProgramManager::StopTracking(Program* /* program */) { | 2495 void ProgramManager::StopTracking(Program* /* program */) { |
2490 --program_count_; | 2496 --program_count_; |
2491 } | 2497 } |
2492 | 2498 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2578 DCHECK(program); | 2584 DCHECK(program); |
2579 program->ClearUniforms(&zero_); | 2585 program->ClearUniforms(&zero_); |
2580 } | 2586 } |
2581 | 2587 |
2582 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { | 2588 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { |
2583 return index + element * 0x10000; | 2589 return index + element * 0x10000; |
2584 } | 2590 } |
2585 | 2591 |
2586 } // namespace gles2 | 2592 } // namespace gles2 |
2587 } // namespace gpu | 2593 } // namespace gpu |
OLD | NEW |