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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/files/scoped_file.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/services/cros_dbus_service.h"
15 #include "dbus/exported_object.h"
16 #include "ui/gfx/geometry/size.h"
17
18 namespace chromeos {
19
20 class CHROMEOS_EXPORT SurfaceServiceProvider
21 : public CrosDBusService::ServiceProviderInterface {
22 public:
23 class Delegate {
24 public:
25 using GraphicsBufferCreatedCallback = base::Callback<void(int32 buffer)>;
26
27 virtual ~Delegate() {}
28
29 // Functions for creating and destroying graphics buffers.
30 virtual void CreateGraphicsBufferFromUnixFd(
31 const gfx::Size& size,
32 base::ScopedFD fd,
33 int32 stride,
34 const GraphicsBufferCreatedCallback& callback) = 0;
35 virtual void DestroyGraphicsBuffer(int32 buffer) = 0;
36
37 // Set contents of the test surface to |buffer|.
38 virtual void SetTestSurfaceContents(int32 buffer) = 0;
39 };
40
41 explicit SurfaceServiceProvider(scoped_ptr<Delegate> delegate);
42 ~SurfaceServiceProvider() override;
43
44 // CrosDBusService::ServiceProviderInterface overrides:
45 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override;
46
47 private:
48 void CreateGraphicsBufferFromUnixFd(
49 dbus::MethodCall* method_call,
50 dbus::ExportedObject::ResponseSender response_sender);
51 void DestroyGraphicsBuffer(
52 dbus::MethodCall* method_call,
53 dbus::ExportedObject::ResponseSender response_sender);
54 void SetTestSurfaceContents(
55 dbus::MethodCall* method_call,
56 dbus::ExportedObject::ResponseSender response_sender);
57
58 // This method is called when a dbus method is exported. If the export of the
59 // method is successful, |success| will be true. It will be false
60 // otherwise.
61 void OnExported(const std::string& interface_name,
62 const std::string& method_name,
63 bool success);
64
65 scoped_ptr<Delegate> delegate_;
66 base::WeakPtrFactory<SurfaceServiceProvider> weak_ptr_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(SurfaceServiceProvider);
69 };
70
71 } // namespace chromeos
72
73 #endif // CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698