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

Unified Diff: gpu/command_buffer/service/gpu_processor_linux.cc

Issue 500132: linux: implement gpu plugin (Closed)
Patch Set: . Created 10 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gpu_processor.cc ('k') | gpu/command_buffer/service/gpu_processor_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gpu_processor_linux.cc
diff --git a/gpu/command_buffer/service/gpu_processor_linux.cc b/gpu/command_buffer/service/gpu_processor_linux.cc
new file mode 100644
index 0000000000000000000000000000000000000000..205cceb115e12ceec4fb66528bc01316b07066cf
--- /dev/null
+++ b/gpu/command_buffer/service/gpu_processor_linux.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <gdk/gdkx.h>
+#include "gpu/command_buffer/service/gpu_processor.h"
+#include "gpu/command_buffer/service/x_utils.h"
+
+using ::base::SharedMemory;
+
+namespace gpu {
+
+bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) {
+ DCHECK(handle);
+
+ // Cannot reinitialize.
+ if (decoder_->window() != NULL)
+ return false;
+
+ // Map the ring buffer and create the parser.
+ Buffer ring_buffer = command_buffer_->GetRingBuffer();
+ if (ring_buffer.ptr) {
+ parser_.reset(new CommandParser(ring_buffer.ptr,
+ ring_buffer.size,
+ 0,
+ ring_buffer.size,
+ 0,
+ decoder_.get()));
+ } else {
+ parser_.reset(new CommandParser(NULL, 0, 0, 0, 0,
+ decoder_.get()));
+ }
+
+ // Initialize GAPI immediately if the window handle is valid.
+ XWindowWrapper *window = new XWindowWrapper(GDK_DISPLAY(), handle);
+ decoder_->set_window_wrapper(window);
+ return decoder_->Initialize();
+}
+
+void GPUProcessor::Destroy() {
+ // Destroy GAPI if window handle has not already become invalid.
+ XWindowWrapper *window = decoder_->window();
+ if (window) {
+ decoder_->Destroy();
+ decoder_->set_window_wrapper(NULL);
+ delete window;
+ }
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/gpu_processor.cc ('k') | gpu/command_buffer/service/gpu_processor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698