OLD | NEW |
---|---|
(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 | |
17 namespace chromeos { | |
18 | |
19 class CHROMEOS_EXPORT SurfaceServiceProvider | |
20 : public CrosDBusService::ServiceProviderInterface { | |
21 public: | |
22 class Delegate { | |
23 public: | |
24 using CreateBufferCallback = base::Callback<void(bool success)>; | |
25 | |
26 virtual ~Delegate() {} | |
27 | |
28 // Functions for creating and destroying buffers. | |
29 virtual void CreatePrimeBuffer(uint32 id, | |
30 base::ScopedFD fd, | |
31 int32 width, | |
32 int32 height, | |
33 uint32 format, | |
34 int32 stride, | |
35 const CreateBufferCallback& callback) = 0; | |
36 virtual void DestroyBuffer(uint32 id) = 0; | |
37 virtual void AttachBufferToTestShellSurface( | |
38 uint32 buffer_id, | |
39 const base::Closure& released_callback); | |
Junichi Uekawa
2015/10/20 04:11:33
This is not defined anywhere, and should marked as
| |
40 }; | |
41 | |
42 explicit SurfaceServiceProvider(scoped_ptr<Delegate> delegate); | |
43 ~SurfaceServiceProvider() override; | |
44 | |
45 // CrosDBusService::ServiceProviderInterface overrides: | |
46 void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; | |
47 | |
48 private: | |
49 void CreatePrimeBuffer(dbus::MethodCall* method_call, | |
50 dbus::ExportedObject::ResponseSender response_sender); | |
51 void DestroyBuffer(dbus::MethodCall* method_call, | |
52 dbus::ExportedObject::ResponseSender response_sender); | |
53 void AttachBufferToTestShellSurface( | |
54 dbus::MethodCall* method_call, | |
55 dbus::ExportedObject::ResponseSender response_sender); | |
56 void ReleaseBuffer(uint32 id); | |
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 scoped_refptr<dbus::ExportedObject> exported_object_; | |
67 base::WeakPtrFactory<SurfaceServiceProvider> weak_ptr_factory_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(SurfaceServiceProvider); | |
70 }; | |
71 | |
72 } // namespace chromeos | |
73 | |
74 #endif // CHROMEOS_DBUS_SERVICES_SURFACE_SERVICE_PROVIDER_H_ | |
OLD | NEW |