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

Side by Side Diff: remoting/client/jni/display_updater_factory.h

Issue 2338473002: [Remoting Android] JniGlDisplayHandler calls invalidate() on UI thread (Closed)
Patch Set: add null-check in deleter Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_ 5 #ifndef REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_
6 #define REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_ 6 #define REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 13
14 namespace protocol { 14 namespace protocol {
15 class CursorShapeStub; 15 class CursorShapeStub;
16 class VideoRenderer; 16 class VideoRenderer;
17 } // namespace protocol 17 } // namespace protocol
18 18
19 // Interface for creating objects to update image (desktop frame or cursor 19 // Interface for creating objects to update image (desktop frame or cursor
20 // shape) to display. Factory functions can be called on any thread but the 20 // shape) to display. Factory functions can be called on any thread but the
21 // returned object should be used on the network thread. 21 // returned object should be used on the network thread.
22 class DisplayUpdaterFactory { 22 class DisplayUpdaterFactory {
Sergey Ulanov 2016/09/19 21:14:56 Do we need to keep this interface? I think we need
Yuwei 2016/09/19 23:52:10 That's what I have considered. Removed.
23 public: 23 public:
24 virtual ~DisplayUpdaterFactory() {} 24 // A deleter that calls Destroy() to delete the factory.
Lambros 2016/09/16 01:44:12 Does it make sense for this deleter (and Destroy m
Yuwei 2016/09/16 21:49:44 I don't have a strong opinion. My justifications a
25 struct Deleter {
26 void operator()(DisplayUpdaterFactory* factory) {
27 if (factory) {
28 factory->Destroy();
29 }
30 }
31 };
25 32
26 virtual std::unique_ptr<protocol::CursorShapeStub> 33 virtual std::unique_ptr<protocol::CursorShapeStub>
27 CreateCursorShapeStub() = 0; 34 CreateCursorShapeStub() = 0;
28 virtual std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() = 0; 35 virtual std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() = 0;
29 36
37 // Destroys the factory object and frees the memory.
38 virtual void Destroy() = 0;
39
30 protected: 40 protected:
41 virtual ~DisplayUpdaterFactory() {}
31 DisplayUpdaterFactory() {} 42 DisplayUpdaterFactory() {}
32 43
33 private: 44 private:
34 DISALLOW_COPY_AND_ASSIGN(DisplayUpdaterFactory); 45 DISALLOW_COPY_AND_ASSIGN(DisplayUpdaterFactory);
35 }; 46 };
36 47
37 } // namespace remoting 48 } // namespace remoting
38 49
39 #endif // REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_ 50 #endif // REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698