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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_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> |
11 #include <set> | 11 #include <set> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/bits.h" | 14 #include "base/bits.h" |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
20 #include "base/trace_event/memory_dump_manager.h" | 20 #include "base/trace_event/memory_dump_manager.h" |
21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
22 #include "gpu/command_buffer/service/context_state.h" | 22 #include "gpu/command_buffer/service/context_state.h" |
23 #include "gpu/command_buffer/service/error_state.h" | 23 #include "gpu/command_buffer/service/error_state.h" |
24 #include "gpu/command_buffer/service/feature_info.h" | 24 #include "gpu/command_buffer/service/feature_info.h" |
25 #include "gpu/command_buffer/service/framebuffer_manager.h" | 25 #include "gpu/command_buffer/service/framebuffer_manager.h" |
26 #include "gpu/command_buffer/service/gl_stream_texture_image.h" | 26 #include "gpu/command_buffer/service/gl_stream_texture_image.h" |
27 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 27 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
28 #include "gpu/command_buffer/service/mailbox_manager.h" | 28 #include "gpu/command_buffer/service/mailbox_manager.h" |
29 #include "gpu/command_buffer/service/memory_tracking.h" | 29 #include "gpu/command_buffer/service/memory_tracking.h" |
30 #include "gpu/command_buffer/service/progress_reporter.h" | |
30 #include "ui/gl/gl_context.h" | 31 #include "ui/gl/gl_context.h" |
31 #include "ui/gl/gl_implementation.h" | 32 #include "ui/gl/gl_implementation.h" |
32 #include "ui/gl/gl_state_restorer.h" | 33 #include "ui/gl/gl_state_restorer.h" |
33 #include "ui/gl/gl_version_info.h" | 34 #include "ui/gl/gl_version_info.h" |
34 #include "ui/gl/trace_util.h" | 35 #include "ui/gl/trace_util.h" |
35 | 36 |
36 namespace gpu { | 37 namespace gpu { |
37 namespace gles2 { | 38 namespace gles2 { |
38 | 39 |
39 namespace { | 40 namespace { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 CHECK_EQ(texture_count_, 0u); | 353 CHECK_EQ(texture_count_, 0u); |
353 | 354 |
354 DCHECK_EQ(0, num_unsafe_textures_); | 355 DCHECK_EQ(0, num_unsafe_textures_); |
355 DCHECK_EQ(0, num_uncleared_mips_); | 356 DCHECK_EQ(0, num_uncleared_mips_); |
356 DCHECK_EQ(0, num_images_); | 357 DCHECK_EQ(0, num_images_); |
357 | 358 |
358 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 359 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
359 this); | 360 this); |
360 } | 361 } |
361 | 362 |
362 void TextureManager::Destroy(bool have_context) { | 363 void TextureManager::Destroy(bool have_context, |
364 ProgressReporter* progress_reporter) { | |
363 have_context_ = have_context; | 365 have_context_ = have_context; |
364 textures_.clear(); | 366 |
367 while (!textures_.empty()) { | |
368 textures_.erase(textures_.begin()); | |
369 if (progress_reporter) | |
danakj
2016/10/05 01:53:48
same same
ericrk
2016/10/05 18:07:31
removed
| |
370 progress_reporter->ReportProgress(); | |
371 } | |
365 for (int ii = 0; ii < kNumDefaultTextures; ++ii) { | 372 for (int ii = 0; ii < kNumDefaultTextures; ++ii) { |
366 default_textures_[ii] = NULL; | 373 default_textures_[ii] = NULL; |
374 if (progress_reporter) | |
danakj
2016/10/05 01:53:48
ame
ericrk
2016/10/05 18:07:31
emoved
| |
375 progress_reporter->ReportProgress(); | |
367 } | 376 } |
368 | 377 |
369 if (have_context) { | 378 if (have_context) { |
370 glDeleteTextures(arraysize(black_texture_ids_), black_texture_ids_); | 379 glDeleteTextures(arraysize(black_texture_ids_), black_texture_ids_); |
371 } | 380 } |
372 | 381 |
373 DCHECK_EQ(0u, memory_type_tracker_->GetMemRepresented()); | 382 DCHECK_EQ(0u, memory_type_tracker_->GetMemRepresented()); |
374 } | 383 } |
375 | 384 |
376 TextureBase::TextureBase(GLuint service_id) | 385 TextureBase::TextureBase(GLuint service_id) |
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3467 uint32_t TextureManager::GetServiceIdGeneration() const { | 3476 uint32_t TextureManager::GetServiceIdGeneration() const { |
3468 return current_service_id_generation_; | 3477 return current_service_id_generation_; |
3469 } | 3478 } |
3470 | 3479 |
3471 void TextureManager::IncrementServiceIdGeneration() { | 3480 void TextureManager::IncrementServiceIdGeneration() { |
3472 current_service_id_generation_++; | 3481 current_service_id_generation_++; |
3473 } | 3482 } |
3474 | 3483 |
3475 } // namespace gles2 | 3484 } // namespace gles2 |
3476 } // namespace gpu | 3485 } // namespace gpu |
OLD | NEW |