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

Side by Side Diff: gpu/command_buffer/service/command_buffer_service.cc

Issue 465040: Added CommandBufferClient, CommandBufferStub and some IPC messages.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 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 "gpu/command_buffer/service/command_buffer_service.h" 5 #include "gpu/command_buffer/service/command_buffer_service.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 using ::base::SharedMemory; 9 using ::base::SharedMemory;
10 10
11 namespace command_buffer { 11 namespace gpu {
12 12
13 CommandBufferService::CommandBufferService() 13 CommandBufferService::CommandBufferService()
14 : size_(0), 14 : size_(0),
15 get_offset_(0), 15 get_offset_(0),
16 put_offset_(0), 16 put_offset_(0),
17 token_(0), 17 token_(0),
18 parse_error_(0), 18 parse_error_(0),
19 error_status_(false) { 19 error_status_(false) {
20 // Element zero is always NULL. 20 // Element zero is always NULL.
21 registered_objects_.push_back(linked_ptr<SharedMemory>()); 21 registered_objects_.push_back(linked_ptr<SharedMemory>());
22 } 22 }
23 23
24 CommandBufferService::~CommandBufferService() { 24 CommandBufferService::~CommandBufferService() {
25 } 25 }
26 26
27 bool CommandBufferService::Initialize(::base::SharedMemory* ring_buffer) { 27 base::SharedMemory* CommandBufferService::Initialize(int32 size) {
28 DCHECK(ring_buffer);
29
30 // Fail if already initialized. 28 // Fail if already initialized.
31 if (ring_buffer_.get()) 29 if (ring_buffer_.get())
32 return false; 30 return false;
33 31
34 size_t size_in_bytes = ring_buffer->max_size(); 32 size_ = size;
35 size_ = size_in_bytes / sizeof(int32);
36 ring_buffer_.reset(ring_buffer);
37 33
38 return true; 34 ring_buffer_.reset(new SharedMemory);
35 if (ring_buffer_->Create(std::wstring(), false, false, size_)) {
36 if (ring_buffer_->Map(size_))
37 return ring_buffer_.get();
38 }
39
40 ring_buffer_.reset();
41 return NULL;
39 } 42 }
40 43
41 SharedMemory* CommandBufferService::GetRingBuffer() { 44 SharedMemory* CommandBufferService::GetRingBuffer() {
42 return ring_buffer_.get(); 45 return ring_buffer_.get();
43 } 46 }
44 47
45 int32 CommandBufferService::GetSize() { 48 int32 CommandBufferService::GetSize() {
46 return size_; 49 return size_;
47 } 50 }
48 51
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 154 }
152 155
153 bool CommandBufferService::GetErrorStatus() { 156 bool CommandBufferService::GetErrorStatus() {
154 return error_status_; 157 return error_status_;
155 } 158 }
156 159
157 void CommandBufferService::RaiseErrorStatus() { 160 void CommandBufferService::RaiseErrorStatus() {
158 error_status_ = true; 161 error_status_ = true;
159 } 162 }
160 163
161 } // namespace command_buffer 164 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/command_buffer_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698