Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/plugin/command_buffer_stub.cc

Issue 500132: linux: implement gpu plugin (Closed)
Patch Set: . Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/plugin/command_buffer_stub.h ('k') | chrome/renderer/command_buffer_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/process_util.h" 5 #include "base/process_util.h"
6 #include "base/shared_memory.h" 6 #include "base/shared_memory.h"
7 #include "chrome/common/command_buffer_messages.h" 7 #include "chrome/common/command_buffer_messages.h"
8 #include "chrome/plugin/command_buffer_stub.h" 8 #include "chrome/plugin/command_buffer_stub.h"
9 #include "chrome/plugin/plugin_channel.h" 9 #include "chrome/plugin/plugin_channel.h"
10 10
11 using gpu::Buffer; 11 using gpu::Buffer;
12 12
13 CommandBufferStub::CommandBufferStub(PluginChannel* channel, 13 CommandBufferStub::CommandBufferStub(PluginChannel* channel,
14 gfx::NativeView view) 14 gfx::PluginWindowHandle window)
15 : channel_(channel), 15 : channel_(channel),
16 view_(view) { 16 window_(window) {
17 route_id_ = channel->GenerateRouteID(); 17 route_id_ = channel->GenerateRouteID();
18 channel->AddRoute(route_id_, this, false); 18 channel->AddRoute(route_id_, this, false);
19 } 19 }
20 20
21 CommandBufferStub::~CommandBufferStub() { 21 CommandBufferStub::~CommandBufferStub() {
22 channel_->RemoveRoute(route_id_); 22 channel_->RemoveRoute(route_id_);
23 } 23 }
24 24
25 void CommandBufferStub::OnChannelError() { 25 void CommandBufferStub::OnChannelError() {
26 NOTREACHED() << "CommandBufferService::OnChannelError called"; 26 NOTREACHED() << "CommandBufferService::OnChannelError called";
(...skipping 20 matching lines...) Expand all
47 if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) 47 if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
48 return; 48 return;
49 49
50 command_buffer_.reset(new gpu::CommandBufferService); 50 command_buffer_.reset(new gpu::CommandBufferService);
51 51
52 // Initialize the CommandBufferService and GPUProcessor. 52 // Initialize the CommandBufferService and GPUProcessor.
53 if (command_buffer_->Initialize(size)) { 53 if (command_buffer_->Initialize(size)) {
54 Buffer buffer = command_buffer_->GetRingBuffer(); 54 Buffer buffer = command_buffer_->GetRingBuffer();
55 if (buffer.shared_memory) { 55 if (buffer.shared_memory) {
56 processor_ = new gpu::GPUProcessor(command_buffer_.get()); 56 processor_ = new gpu::GPUProcessor(command_buffer_.get());
57 if (processor_->Initialize(view_)) { 57 if (processor_->Initialize(window_)) {
58 command_buffer_->SetPutOffsetChangeCallback( 58 command_buffer_->SetPutOffsetChangeCallback(
59 NewCallback(processor_.get(), 59 NewCallback(processor_.get(),
60 &gpu::GPUProcessor::ProcessCommands)); 60 &gpu::GPUProcessor::ProcessCommands));
61 buffer.shared_memory->ShareToProcess(peer_handle, ring_buffer); 61 buffer.shared_memory->ShareToProcess(peer_handle, ring_buffer);
62 } else { 62 } else {
63 processor_ = NULL; 63 processor_ = NULL;
64 command_buffer_.reset(); 64 command_buffer_.reset();
65 } 65 }
66 } 66 }
67 } 67 }
(...skipping 18 matching lines...) Expand all
86 } 86 }
87 87
88 void CommandBufferStub::OnDestroyTransferBuffer(int32 id) { 88 void CommandBufferStub::OnDestroyTransferBuffer(int32 id) {
89 command_buffer_->DestroyTransferBuffer(id); 89 command_buffer_->DestroyTransferBuffer(id);
90 } 90 }
91 91
92 void CommandBufferStub::OnGetTransferBuffer( 92 void CommandBufferStub::OnGetTransferBuffer(
93 int32 id, 93 int32 id,
94 base::SharedMemoryHandle* transfer_buffer, 94 base::SharedMemoryHandle* transfer_buffer,
95 size_t* size) { 95 size_t* size) {
96 *transfer_buffer = 0; 96 *transfer_buffer = base::SharedMemoryHandle();
97 *size = 0; 97 *size = 0;
98 98
99 // Assume service is responsible for duplicating the handle to the calling 99 // Assume service is responsible for duplicating the handle to the calling
100 // process. 100 // process.
101 base::ProcessHandle peer_handle; 101 base::ProcessHandle peer_handle;
102 if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle)) 102 if (!base::OpenProcessHandle(channel_->peer_pid(), &peer_handle))
103 return; 103 return;
104 104
105 Buffer buffer = command_buffer_->GetTransferBuffer(id); 105 Buffer buffer = command_buffer_->GetTransferBuffer(id);
106 if (buffer.shared_memory) { 106 if (buffer.shared_memory) {
(...skipping 27 matching lines...) Expand all
134 IPC_MESSAGE_HANDLER(CommandBufferMsg_DestroyTransferBuffer, 134 IPC_MESSAGE_HANDLER(CommandBufferMsg_DestroyTransferBuffer,
135 OnDestroyTransferBuffer); 135 OnDestroyTransferBuffer);
136 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetTransferBuffer, 136 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetTransferBuffer,
137 OnGetTransferBuffer); 137 OnGetTransferBuffer);
138 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetToken, OnGetToken); 138 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetToken, OnGetToken);
139 IPC_MESSAGE_HANDLER(CommandBufferMsg_ResetParseError, OnResetParseError); 139 IPC_MESSAGE_HANDLER(CommandBufferMsg_ResetParseError, OnResetParseError);
140 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetErrorStatus, OnGetErrorStatus); 140 IPC_MESSAGE_HANDLER(CommandBufferMsg_GetErrorStatus, OnGetErrorStatus);
141 IPC_MESSAGE_UNHANDLED_ERROR() 141 IPC_MESSAGE_UNHANDLED_ERROR()
142 IPC_END_MESSAGE_MAP() 142 IPC_END_MESSAGE_MAP()
143 } 143 }
OLDNEW
« no previous file with comments | « chrome/plugin/command_buffer_stub.h ('k') | chrome/renderer/command_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698