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/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
6 | 6 |
7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/GLES2/gl2.h" |
8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 10 #endif |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 } | 1425 } |
1426 | 1426 |
1427 bool WebGraphicsContext3DCommandBufferImpl::ShouldUseSwapClient() { | 1427 bool WebGraphicsContext3DCommandBufferImpl::ShouldUseSwapClient() { |
1428 return factory_ && factory_->IsMainThread() && swap_client_.get(); | 1428 return factory_ && factory_->IsMainThread() && swap_client_.get(); |
1429 } | 1429 } |
1430 | 1430 |
1431 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() { | 1431 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() { |
1432 typedef WebGraphicsContext3DSwapBuffersClient WGC3DSwapClient; | 1432 typedef WebGraphicsContext3DSwapBuffersClient WGC3DSwapClient; |
1433 // This may be called after tear-down of the RenderView. | 1433 // This may be called after tear-down of the RenderView. |
1434 if (ShouldUseSwapClient()) { | 1434 if (ShouldUseSwapClient()) { |
1435 MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 1435 base::MessageLoop::current()->PostTask( |
1436 &WGC3DSwapClient::OnViewContextSwapBuffersComplete, swap_client_)); | 1436 FROM_HERE, |
| 1437 base::Bind(&WGC3DSwapClient::OnViewContextSwapBuffersComplete, |
| 1438 swap_client_)); |
1437 } | 1439 } |
1438 | 1440 |
1439 if (swapbuffers_complete_callback_) | 1441 if (swapbuffers_complete_callback_) |
1440 swapbuffers_complete_callback_->onSwapBuffersComplete(); | 1442 swapbuffers_complete_callback_->onSwapBuffersComplete(); |
1441 } | 1443 } |
1442 | 1444 |
1443 WebGraphicsMemoryAllocation::PriorityCutoff | 1445 WebGraphicsMemoryAllocation::PriorityCutoff |
1444 WebGraphicsContext3DCommandBufferImpl::WebkitPriorityCutoff( | 1446 WebGraphicsContext3DCommandBufferImpl::WebkitPriorityCutoff( |
1445 GpuMemoryAllocationForRenderer::PriorityCutoff priorityCutoff) { | 1447 GpuMemoryAllocationForRenderer::PriorityCutoff priorityCutoff) { |
1446 switch (priorityCutoff) { | 1448 switch (priorityCutoff) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 | 1742 |
1741 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1743 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1742 const std::string& message, int id) { | 1744 const std::string& message, int id) { |
1743 if (error_message_callback_) { | 1745 if (error_message_callback_) { |
1744 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1746 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1745 error_message_callback_->onErrorMessage(str, id); | 1747 error_message_callback_->onErrorMessage(str, id); |
1746 } | 1748 } |
1747 } | 1749 } |
1748 | 1750 |
1749 } // namespace content | 1751 } // namespace content |
OLD | NEW |