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 IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | 5 #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ |
6 #define IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | 6 #define MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "base/macros.h" | 9 #include "media/base/mac/videotoolbox_glue.h" |
10 #include "ios/public/provider/web/web_ui_ios_message_handler.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 /////////////////////////////////////////////////////////////////////////////// | 12 namespace media { |
13 // MetricsHandler | |
14 | 13 |
15 // Let the page contents record UMA actions. Only use when you can't do it from | 14 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> |
16 // C++. For example, we currently use it to let the NTP log the position of the | 15 DictionaryWithKeysAndValues(CFTypeRef* keys, CFTypeRef* values, size_t size); |
miu
2016/02/04 22:23:20
All of these functions are VT-specific, but have r
miu
2016/02/04 22:23:20
Also, throughout this file, can you please add a c
emircan
2016/02/07 04:24:06
Done.
emircan
2016/02/07 04:24:06
Done.
| |
17 // Most Visited or Bookmark the user clicked on, as we don't get that | |
18 // information through RequestOpenURL. You will need to update the metrics | |
19 // dashboard with the action names you use, as our processor won't catch that | |
20 // information (treat it as RecordComputedMetrics) | |
21 | 16 |
22 namespace base { | 17 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> DictionaryWithKeyValue( |
23 class ListValue; | 18 CFTypeRef key, |
24 } | 19 CFTypeRef value); |
25 | 20 |
26 class MetricsHandler : public web::WebUIIOSMessageHandler { | 21 MEDIA_EXPORT base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v, |
27 public: | 22 size_t size); |
28 MetricsHandler(); | |
29 ~MetricsHandler() override; | |
30 | 23 |
31 // WebUIIOSMessageHandler implementation. | 24 template <typename NalSizeType> |
32 void RegisterMessages() override; | 25 MEDIA_EXPORT void CopyNalsToAnnexB(char* avcc_buffer, |
26 const size_t avcc_size, | |
27 std::string* annexb_buffer); | |
33 | 28 |
34 // Callback for the "metricsHandler:recordAction" message. This records a | 29 MEDIA_EXPORT void CopySampleBufferToAnnexBBuffer( |
35 // user action. | 30 CoreMediaGlue::CMSampleBufferRef sbuf, |
36 void HandleRecordAction(const base::ListValue* args); | 31 std::string* annexb_buffer, |
32 bool keyframe); | |
37 | 33 |
38 // TODO(dbeam): http://crbug.com/104338 | 34 using VTCompressionSessionRef = VideoToolboxGlue::VTCompressionSessionRef; |
miu
2016/02/04 22:23:20
style guide violation: Please remove this. Better
emircan
2016/02/07 04:24:06
Done.
| |
39 | 35 |
40 // Callback for the "metricsHandler:recordInHistogram" message. This records | 36 MEDIA_EXPORT bool SetSessionProperty( |
41 // into a histogram. |args| contains the histogram name, the value to record, | 37 base::ScopedCFTypeRef<VTCompressionSessionRef> session, |
42 // and the maximum allowed value, which can be at most 4000. The histogram | 38 const VideoToolboxGlue* const glue, |
43 // will use at most 100 buckets, one for each 1, 10, or 100 different values, | 39 CFStringRef key, |
44 // depending on the maximum value. | 40 int32_t value); |
45 void HandleRecordInHistogram(const base::ListValue* args); | |
46 | 41 |
47 private: | 42 MEDIA_EXPORT bool SetSessionProperty( |
48 DISALLOW_COPY_AND_ASSIGN(MetricsHandler); | 43 base::ScopedCFTypeRef<VTCompressionSessionRef> session, |
49 }; | 44 const VideoToolboxGlue* const glue, |
45 CFStringRef key, | |
46 bool value); | |
50 | 47 |
51 #endif // IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | 48 MEDIA_EXPORT bool SetSessionProperty( |
49 base::ScopedCFTypeRef<VTCompressionSessionRef> session, | |
50 const VideoToolboxGlue* const glue, | |
51 CFStringRef key, | |
52 CFStringRef value); | |
53 | |
54 } // namespace media | |
55 | |
56 #endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_ | |
OLD | NEW |