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

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

Issue 2007123003: [Android Client] Break down multi-threaded classes by thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2016 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 REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
6 #define REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
7
8 #include <jni.h>
9
10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "remoting/proto/control.pb.h"
14
15 namespace remoting {
16
17 // Handles display operations. Must be called and deleted on the display thread
18 // unless otherwise noted.
19 class JniDisplayHandler {
20 public:
21 JniDisplayHandler(scoped_refptr<base::SingleThreadTaskRunner> display_runner,
22 base::android::ScopedJavaGlobalRef<jobject> java_display);
23
24 // Must be deleted on the display thread.
25 ~JniDisplayHandler();
26
27 // Creates a new Bitmap object to store a video frame. Can be called on any
28 // thread.
29 base::android::ScopedJavaLocalRef<jobject> NewBitmap(int width, int height);
30
31 // Updates video frame bitmap. |bitmap| must be an instance of
32 // android.graphics.Bitmap.
33 void UpdateFrameBitmap(base::android::ScopedJavaGlobalRef<jobject> bitmap);
34
35 // Updates cursor shape.
36 void UpdateCursorShape(const protocol::CursorShapeInfo& cursor_shape);
37
38 // Draws the latest image buffer onto the canvas.
39 void RedrawCanvas();
40
41 // Returns a display thread weak pointer to the object.
42 base::WeakPtr<JniDisplayHandler> GetWeakPtr();
43
44 static bool RegisterJni(JNIEnv* env);
45
46 void Destroy(JNIEnv* env,
Lambros 2016/05/28 00:43:06 What thread calls this? Looks like the implementat
Yuwei 2016/06/01 21:30:11 Done. Added comments.
47 const base::android::JavaParamRef<jobject>& caller);
48
49 void ScheduleRedraw(JNIEnv* env,
Lambros 2016/05/28 00:43:06 Add comment that this is called on the UI thread.
Yuwei 2016/06/01 21:30:11 I just wrote "can be called on any thread"...
50 const base::android::JavaParamRef<jobject>& caller);
51
52 private:
53 scoped_refptr<base::SingleThreadTaskRunner> display_runner_;
54
55 base::android::ScopedJavaGlobalRef<jobject> java_display_;
56 base::WeakPtrFactory<JniDisplayHandler> weak_factory_;
57 DISALLOW_COPY_AND_ASSIGN(JniDisplayHandler);
Lambros 2016/05/28 00:43:06 Blank line above DISALLOW...
Yuwei 2016/06/01 21:30:11 Done.
58 };
59
60 } // namespace remoting
61 #endif // REMOTING_CLIENT_JNI_JNI_DISPLAY_HANDLER_H_
Lambros 2016/05/28 00:43:05 Blank line above #endif
Yuwei 2016/06/01 21:30:11 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698