| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/scoped_open_process.h" | 6 #include "base/scoped_open_process.h" |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "chrome/common/gpu_messages.h" | 8 #include "chrome/common/gpu_messages.h" |
| 9 #include "chrome/common/plugin_messages.h" | 9 #include "chrome/common/plugin_messages.h" |
| 10 #include "chrome/plugin/command_buffer_stub.h" | 10 #include "chrome/plugin/command_buffer_stub.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 // Get the ring buffer. | 87 // Get the ring buffer. |
| 88 Buffer buffer = command_buffer_->GetRingBuffer(); | 88 Buffer buffer = command_buffer_->GetRingBuffer(); |
| 89 if (!buffer.shared_memory) { | 89 if (!buffer.shared_memory) { |
| 90 Destroy(); | 90 Destroy(); |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Initialize the GPUProcessor. | 94 // Initialize the GPUProcessor. |
| 95 processor_ = new gpu::GPUProcessor(command_buffer_.get()); | 95 processor_.reset(new gpu::GPUProcessor(command_buffer_.get())); |
| 96 if (!processor_->Initialize(window_)) { | 96 if (!processor_->Initialize(window_, NULL, gfx::Size(), 0)) { |
| 97 Destroy(); | 97 Destroy(); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 | 100 |
| 101 // Perform platform specific initialization. | 101 // Perform platform specific initialization. |
| 102 if (!InitializePlatformSpecific()) { | 102 if (!InitializePlatformSpecific()) { |
| 103 Destroy(); | 103 Destroy(); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Buffer buffer = command_buffer_->GetTransferBuffer(id); | 168 Buffer buffer = command_buffer_->GetTransferBuffer(id); |
| 169 if (buffer.shared_memory) { | 169 if (buffer.shared_memory) { |
| 170 buffer.shared_memory->ShareToProcess(peer_handle, transfer_buffer); | 170 buffer.shared_memory->ShareToProcess(peer_handle, transfer_buffer); |
| 171 *size = buffer.shared_memory->max_size(); | 171 *size = buffer.shared_memory->max_size(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 base::CloseProcessHandle(peer_handle); | 174 base::CloseProcessHandle(peer_handle); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void CommandBufferStub::Destroy() { | 177 void CommandBufferStub::Destroy() { |
| 178 processor_ = NULL; | 178 processor_.reset(); |
| 179 command_buffer_.reset(); | 179 command_buffer_.reset(); |
| 180 | 180 |
| 181 DestroyPlatformSpecific(); | 181 DestroyPlatformSpecific(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 #if !defined(OS_WIN) | 184 #if !defined(OS_WIN) |
| 185 bool CommandBufferStub::InitializePlatformSpecific() { | 185 bool CommandBufferStub::InitializePlatformSpecific() { |
| 186 return true; | 186 return true; |
| 187 } | 187 } |
| 188 | 188 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_, | 235 Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_, |
| 236 size, | 236 size, |
| 237 dib_handle)); | 237 dib_handle)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) { | 240 void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) { |
| 241 Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_, | 241 Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_, |
| 242 dib_id)); | 242 dib_id)); |
| 243 } | 243 } |
| 244 #endif | 244 #endif |
| OLD | NEW |