OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/aura/gpu_process_transport_factory.h" | 5 #include "content/browser/aura/gpu_process_transport_factory.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 float device_scale_factor, | 60 float device_scale_factor, |
61 unsigned int texture_id) | 61 unsigned int texture_id) |
62 : ui::Texture(true, size, device_scale_factor), | 62 : ui::Texture(true, size, device_scale_factor), |
63 host_context_(host_context), | 63 host_context_(host_context), |
64 texture_id_(texture_id) { | 64 texture_id_(texture_id) { |
65 ImageTransportFactory::GetInstance()->AddObserver(this); | 65 ImageTransportFactory::GetInstance()->AddObserver(this); |
66 } | 66 } |
67 | 67 |
68 // ui::Texture overrides: | 68 // ui::Texture overrides: |
69 virtual unsigned int PrepareTexture() OVERRIDE { | 69 virtual unsigned int PrepareTexture() OVERRIDE { |
| 70 if (!host_context_ || host_context_->isContextLost()) |
| 71 return 0u; |
70 return texture_id_; | 72 return texture_id_; |
71 } | 73 } |
72 | 74 |
73 virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE { | 75 virtual WebKit::WebGraphicsContext3D* HostContext3D() OVERRIDE { |
74 return host_context_; | 76 return host_context_; |
75 } | 77 } |
76 | 78 |
77 // ImageTransportFactory overrides: | 79 // ImageTransportFactory overrides: |
78 virtual void OnLostResources() OVERRIDE { | 80 virtual void OnLostResources() OVERRIDE { |
79 DeleteTexture(); | 81 DeleteTexture(); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 observer_list_, | 548 observer_list_, |
547 OnLostResources()); | 549 OnLostResources()); |
548 | 550 |
549 // Kill things that use the shared context before killing the shared context. | 551 // Kill things that use the shared context before killing the shared context. |
550 lost_gl_helper.reset(); | 552 lost_gl_helper.reset(); |
551 lost_offscreen_compositor_contexts = NULL; | 553 lost_offscreen_compositor_contexts = NULL; |
552 lost_shared_main_thread_contexts = NULL; | 554 lost_shared_main_thread_contexts = NULL; |
553 } | 555 } |
554 | 556 |
555 } // namespace content | 557 } // namespace content |
OLD | NEW |