| 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/renderer/pepper/pepper_platform_context_3d.h" | 5 #include "content/renderer/pepper/pepper_platform_context_3d.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/common/gpu/client/context_provider_command_buffer.h" | 8 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
| 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 GURL::EmptyGURL(), | 97 GURL::EmptyGURL(), |
| 98 gpu_preference); | 98 gpu_preference); |
| 99 if (!command_buffer_) | 99 if (!command_buffer_) |
| 100 return false; | 100 return false; |
| 101 if (!command_buffer_->Initialize()) | 101 if (!command_buffer_->Initialize()) |
| 102 return false; | 102 return false; |
| 103 gpu::Mailbox mailbox = gpu::Mailbox::Generate(); | 103 gpu::Mailbox mailbox = gpu::Mailbox::Generate(); |
| 104 if (!command_buffer_->ProduceFrontBuffer(mailbox)) | 104 if (!command_buffer_->ProduceFrontBuffer(mailbox)) |
| 105 return false; | 105 return false; |
| 106 mailbox_ = mailbox; | 106 mailbox_ = mailbox; |
| 107 sync_point_ = command_buffer_->InsertSyncPoint(); |
| 107 | 108 |
| 108 command_buffer_->SetChannelErrorCallback( | 109 command_buffer_->SetChannelErrorCallback( |
| 109 base::Bind(&PlatformContext3D::OnContextLost, | 110 base::Bind(&PlatformContext3D::OnContextLost, |
| 110 weak_ptr_factory_.GetWeakPtr())); | 111 weak_ptr_factory_.GetWeakPtr())); |
| 111 command_buffer_->SetOnConsoleMessageCallback( | 112 command_buffer_->SetOnConsoleMessageCallback( |
| 112 base::Bind(&PlatformContext3D::OnConsoleMessage, | 113 base::Bind(&PlatformContext3D::OnConsoleMessage, |
| 113 weak_ptr_factory_.GetWeakPtr())); | 114 weak_ptr_factory_.GetWeakPtr())); |
| 114 | 115 |
| 115 return true; | 116 return true; |
| 116 } | 117 } |
| 117 | 118 |
| 118 void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox) { | 119 void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox, |
| 120 uint32* sync_point) { |
| 119 *mailbox = mailbox_; | 121 *mailbox = mailbox_; |
| 122 *sync_point = sync_point_; |
| 123 } |
| 124 |
| 125 void PlatformContext3D::InsertSyncPointForBackingMailbox() { |
| 126 DCHECK(command_buffer_); |
| 127 sync_point_ = command_buffer_->InsertSyncPoint(); |
| 120 } | 128 } |
| 121 | 129 |
| 122 bool PlatformContext3D::IsOpaque() { | 130 bool PlatformContext3D::IsOpaque() { |
| 123 DCHECK(command_buffer_); | 131 DCHECK(command_buffer_); |
| 124 return !has_alpha_; | 132 return !has_alpha_; |
| 125 } | 133 } |
| 126 | 134 |
| 127 gpu::CommandBuffer* PlatformContext3D::GetCommandBuffer() { | 135 gpu::CommandBuffer* PlatformContext3D::GetCommandBuffer() { |
| 128 return command_buffer_; | 136 return command_buffer_; |
| 129 } | 137 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 158 } | 166 } |
| 159 | 167 |
| 160 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) { | 168 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) { |
| 161 DCHECK(command_buffer_); | 169 DCHECK(command_buffer_); |
| 162 | 170 |
| 163 if (!console_message_callback_.is_null()) | 171 if (!console_message_callback_.is_null()) |
| 164 console_message_callback_.Run(msg, id); | 172 console_message_callback_.Run(msg, id); |
| 165 } | 173 } |
| 166 | 174 |
| 167 } // namespace content | 175 } // namespace content |
| OLD | NEW |