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

Unified Diff: chromeos/dbus/services/surface_service_provider.h

Issue 1394573003: chromeos: Add SurfaceServiceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « chromeos/chromeos.gyp ('k') | chromeos/dbus/services/surface_service_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/services/surface_service_provider.h
diff --git a/chromeos/dbus/services/surface_service_provider.h b/chromeos/dbus/services/surface_service_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..14b0796800e6d4d2461808f84688dec4346bc975
--- /dev/null
+++ b/chromeos/dbus/services/surface_service_provider.h
@@ -0,0 +1,74 @@
+// Copyright 2015 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.
+
+#ifndef CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
+#define CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
+
+#include <string>
+
+#include "base/files/scoped_file.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/services/cros_dbus_service.h"
+#include "dbus/exported_object.h"
+
+namespace chromeos {
+
+class CHROMEOS_EXPORT SurfaceServiceProvider
+ : public CrosDBusService::ServiceProviderInterface {
+ public:
+ class Delegate {
+ public:
+ using CreateBufferCallback = base::Callback<void(bool success)>;
+
+ virtual ~Delegate() {}
+
+ // Functions for creating and destroying buffers.
+ virtual void CreatePrimeBuffer(uint32 id,
+ base::ScopedFD fd,
+ int32 width,
+ int32 height,
+ uint32 format,
+ int32 stride,
+ const CreateBufferCallback& callback) = 0;
+ virtual void DestroyBuffer(uint32 id) = 0;
+ virtual void AttachBufferToTestShellSurface(
+ uint32 buffer_id,
+ const base::Closure& released_callback);
Junichi Uekawa 2015/10/20 04:11:33 This is not defined anywhere, and should marked as
+ };
+
+ explicit SurfaceServiceProvider(scoped_ptr<Delegate> delegate);
+ ~SurfaceServiceProvider() override;
+
+ // CrosDBusService::ServiceProviderInterface overrides:
+ void Start(scoped_refptr<dbus::ExportedObject> exported_object) override;
+
+ private:
+ void CreatePrimeBuffer(dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender);
+ void DestroyBuffer(dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender);
+ void AttachBufferToTestShellSurface(
+ dbus::MethodCall* method_call,
+ dbus::ExportedObject::ResponseSender response_sender);
+ void ReleaseBuffer(uint32 id);
+
+ // This method is called when a dbus method is exported. If the export of the
+ // method is successful, |success| will be true. It will be false
+ // otherwise.
+ void OnExported(const std::string& interface_name,
+ const std::string& method_name,
+ bool success);
+
+ scoped_ptr<Delegate> delegate_;
+ scoped_refptr<dbus::ExportedObject> exported_object_;
+ base::WeakPtrFactory<SurfaceServiceProvider> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceServiceProvider);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/dbus/services/surface_service_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698