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 "content/common/gpu/client/gl_helper.h" | 5 #include "content/common/gpu/client/gl_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_restrictions.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
15 #include "ui/gfx/gl/gl_bindings.h" | 16 #include "ui/gfx/gl/gl_bindings.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 const char kGLHelperThreadName[] = "GLHelperThread"; | 21 const char kGLHelperThreadName[] = "GLHelperThread"; |
21 | 22 |
22 class GLHelperThread : public base::Thread { | 23 class GLHelperThread : public base::Thread { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 if (decremented_count == 0) { | 541 if (decremented_count == 0) { |
541 // When this is the last instance, we synchronize with the pending | 542 // When this is the last instance, we synchronize with the pending |
542 // operations on GLHelperThread. Otherwise on shutdown we may kill the GPU | 543 // operations on GLHelperThread. Otherwise on shutdown we may kill the GPU |
543 // process infrastructure (BrowserGpuChannelHostFactory) before they have | 544 // process infrastructure (BrowserGpuChannelHostFactory) before they have |
544 // a chance to complete, likely leading to a crash. | 545 // a chance to complete, likely leading to a crash. |
545 base::WaitableEvent event(false, false); | 546 base::WaitableEvent event(false, false); |
546 g_gl_helper_thread.Pointer()->message_loop_proxy()->PostTask( | 547 g_gl_helper_thread.Pointer()->message_loop_proxy()->PostTask( |
547 FROM_HERE, | 548 FROM_HERE, |
548 base::Bind(&SignalWaitableEvent, | 549 base::Bind(&SignalWaitableEvent, |
549 &event)); | 550 &event)); |
| 551 // http://crbug.com/125415 |
| 552 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
550 event.Wait(); | 553 event.Wait(); |
551 } | 554 } |
552 } | 555 } |
553 | 556 |
554 WebKit::WebGraphicsContext3D* GLHelper::context() const { | 557 WebKit::WebGraphicsContext3D* GLHelper::context() const { |
555 return context_; | 558 return context_; |
556 } | 559 } |
557 | 560 |
558 void GLHelper::Detach() { | 561 void GLHelper::Detach() { |
559 if (copy_texture_to_impl_.get()) | 562 if (copy_texture_to_impl_.get()) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 WebKit::WGC3Dint compile_status = 0; | 607 WebKit::WGC3Dint compile_status = 0; |
605 context_->getShaderiv(shader, GL_COMPILE_STATUS, &compile_status); | 608 context_->getShaderiv(shader, GL_COMPILE_STATUS, &compile_status); |
606 if (!compile_status) { | 609 if (!compile_status) { |
607 LOG(ERROR) << std::string(context_->getShaderInfoLog(shader).utf8()); | 610 LOG(ERROR) << std::string(context_->getShaderInfoLog(shader).utf8()); |
608 return 0; | 611 return 0; |
609 } | 612 } |
610 return shader.Detach(); | 613 return shader.Detach(); |
611 } | 614 } |
612 | 615 |
613 } // namespace content | 616 } // namespace content |
OLD | NEW |