Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 { |
|
Hzj_jie
2016/09/13 19:32:12
Will this class be removed eventually? It looks li
Yuwei
2016/09/13 20:49:40
I'm thinking about removing this class but just no
| |
| 23 public: | 23 public: |
| 24 virtual ~DisplayUpdaterFactory() {} | 24 // A deleter that calls Destroy() to delete the factory. |
| 25 struct Deleter { | |
| 26 void operator()(DisplayUpdaterFactory* factory) { | |
|
Hzj_jie
2016/09/13 19:32:12
if (factory) {
factory->Destroy();
}
I happen t
Yuwei
2016/09/13 20:49:40
Added the null-check.
| |
| 27 factory->Destroy(); | |
| 28 } | |
| 29 }; | |
| 25 | 30 |
| 26 virtual std::unique_ptr<protocol::CursorShapeStub> | 31 virtual std::unique_ptr<protocol::CursorShapeStub> |
| 27 CreateCursorShapeStub() = 0; | 32 CreateCursorShapeStub() = 0; |
| 28 virtual std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() = 0; | 33 virtual std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() = 0; |
| 29 | 34 |
| 35 // Destroys the factory object and frees the memory. | |
| 36 virtual void Destroy() = 0; | |
| 37 | |
| 30 protected: | 38 protected: |
| 39 virtual ~DisplayUpdaterFactory() {} | |
| 31 DisplayUpdaterFactory() {} | 40 DisplayUpdaterFactory() {} |
| 32 | 41 |
| 33 private: | 42 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(DisplayUpdaterFactory); | 43 DISALLOW_COPY_AND_ASSIGN(DisplayUpdaterFactory); |
| 35 }; | 44 }; |
| 36 | 45 |
| 37 } // namespace remoting | 46 } // namespace remoting |
| 38 | 47 |
| 39 #endif // REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_ | 48 #endif // REMOTING_CLIENT_JNI_DISPLAY_UPDATER_FACTORY_H_ |
| OLD | NEW |