OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUNCHE R_H_ |
7 | 7 |
8 #include "content/browser/renderer_host/media/video_capture_provider.h" | 8 #include "content/browser/renderer_host/media/video_capture_provider.h" |
9 #include "content/public/common/media_stream_request.h" | 9 #include "content/public/common/media_stream_request.h" |
10 #include "services/video_capture/public/interfaces/device_factory.mojom.h" | 10 #include "services/video_capture/public/interfaces/device_factory.mojom.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 MediaStreamType stream_type, | 24 MediaStreamType stream_type, |
25 const media::VideoCaptureParams& params, | 25 const media::VideoCaptureParams& params, |
26 base::WeakPtr<media::VideoFrameReceiver> receiver, | 26 base::WeakPtr<media::VideoFrameReceiver> receiver, |
27 Callbacks* callbacks, | 27 Callbacks* callbacks, |
28 base::OnceClosure done_cb) override; | 28 base::OnceClosure done_cb) override; |
29 void AbortLaunch() override; | 29 void AbortLaunch() override; |
30 | 30 |
31 void OnUtilizationReport(int frame_feedback_id, double utilization); | 31 void OnUtilizationReport(int frame_feedback_id, double utilization); |
32 | 32 |
33 private: | 33 private: |
34 enum class State { | |
35 READY_TO_LAUNCH, | |
36 DEVICE_START_IN_PROGRESS, | |
37 DEVICE_START_ABORTING | |
38 }; | |
39 | |
40 void OnCreateDeviceCallback( | |
41 const media::VideoCaptureParams& params, | |
42 video_capture::mojom::DevicePtr device, | |
43 base::WeakPtr<media::VideoFrameReceiver> receiver, | |
44 Callbacks* callbacks, | |
45 base::OnceClosure done_cb, | |
46 video_capture::mojom::DeviceAccessResultCode result_code); | |
47 void OnDeviceCreatedSuccessfully( | |
48 const media::VideoCaptureParams& params, | |
49 video_capture::mojom::DevicePtr device, | |
50 base::WeakPtr<media::VideoFrameReceiver> receiver, | |
51 Callbacks* callbacks, | |
52 base::OnceClosure done_cb); | |
53 void OnDeviceCreationFailed(Callbacks* callbacks, base::OnceClosure done_cb); | |
mcasas
2017/05/05 22:41:02
Actually since OnDeviceCreatedSuccessfully()
and O
chfremer
2017/05/08 17:01:54
I wasn't aware that an "On" prefix is reserved for
miu
2017/05/08 20:21:11
FWIW, I tend to use:
OnSomething() - A method t
chfremer
2017/05/08 20:51:46
Looks reasonable (even though I am still not quite
mcasas
2017/05/08 21:08:04
Right. What I meant is that I'd rather use
OnTheEv
chfremer
2017/05/08 21:56:31
Hmm, the method OnCreateDeviceCallback() is also i
miu
2017/05/09 19:34:19
The caller. Always the caller. There are thousands
miu
2017/05/09 19:34:19
IMHO, OnSomething() is more for interfaces and the
| |
54 | |
34 video_capture::mojom::DeviceFactoryPtr* const device_factory_; | 55 video_capture::mojom::DeviceFactoryPtr* const device_factory_; |
56 State state_; | |
57 base::ThreadChecker thread_checker_; | |
35 }; | 58 }; |
36 | 59 |
37 } // namespace content | 60 } // namespace content |
38 | 61 |
39 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_ | 62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_SERVICE_VIDEO_CAPTURE_DEVICE_LAUN CHER_H_ |
OLD | NEW |