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

Side by Side Diff: chrome/common/child_process_logging.h

Issue 9600060: SetPrinterInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ 5 #ifndef CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
6 #define CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ 6 #define CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/mac/crash_logging.h" 13 #include "base/mac/crash_logging.h"
14 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
15 15
16 class CommandLine; 16 class CommandLine;
17 17
18 namespace content { 18 namespace content {
19 struct GPUInfo; 19 struct GPUInfo;
20 } 20 }
21 21
22 // The maximum number of active extensions we will report. 22 // The maximum number of active extensions we will report.
23 // Also used in chrome/app, but we define it here to avoid a common->app 23 // Also used in chrome/app, but we define it here to avoid a common->app
24 // dependency. 24 // dependency.
25 static const int kMaxReportedActiveExtensions = 10; 25 static const int kMaxReportedActiveExtensions = 10;
26 26
27 // The maximum number of prn-info-* records.
28 static const size_t kMaxReportedPrinterRecords = 4;
29
27 // The maximum number of command line switches to include in the crash 30 // The maximum number of command line switches to include in the crash
28 // report's metadata. Note that the mini-dump itself will also contain the 31 // report's metadata. Note that the mini-dump itself will also contain the
29 // (original) command line arguments within the PEB. 32 // (original) command line arguments within the PEB.
30 // Also used in chrome/app, but we define it here to avoid a common->app 33 // Also used in chrome/app, but we define it here to avoid a common->app
31 // dependency. 34 // dependency.
32 static const size_t kMaxSwitches = 15; 35 static const size_t kMaxSwitches = 15;
33 36
34 namespace child_process_logging { 37 namespace child_process_logging {
35 38
36 #if defined(OS_POSIX) && !defined(OS_MACOSX) 39 #if defined(OS_POSIX) && !defined(OS_MACOSX)
37 // These are declared here so the crash reporter can access them directly in 40 // These are declared here so the crash reporter can access them directly in
38 // compromised context without going through the standard library. 41 // compromised context without going through the standard library.
39 extern char g_active_url[]; 42 extern char g_active_url[];
40 extern char g_channel[]; 43 extern char g_channel[];
41 extern char g_client_id[]; 44 extern char g_client_id[];
42 extern char g_extension_ids[]; 45 extern char g_extension_ids[];
43 extern char g_gpu_vendor_id[]; 46 extern char g_gpu_vendor_id[];
44 extern char g_gpu_device_id[]; 47 extern char g_gpu_device_id[];
45 extern char g_gpu_driver_ver[]; 48 extern char g_gpu_driver_ver[];
46 extern char g_gpu_ps_ver[]; 49 extern char g_gpu_ps_ver[];
47 extern char g_gpu_vs_ver[]; 50 extern char g_gpu_vs_ver[];
51 extern char g_prn_info[];
Lei Zhang 2012/03/14 04:20:05 nit: alphabetical order.
Vitaly Buka (NO REVIEWS) 2012/03/14 20:37:42 Done.
48 extern char g_num_extensions[]; 52 extern char g_num_extensions[];
49 extern char g_num_switches[]; 53 extern char g_num_switches[];
50 extern char g_num_views[]; 54 extern char g_num_views[];
51 extern char g_switches[]; 55 extern char g_switches[];
52 56
53 // Assume IDs are 32 bytes long. 57 // Assume IDs are 32 bytes long.
54 static const size_t kExtensionLen = 32; 58 static const size_t kExtensionLen = 32;
55 59
56 // Assume command line switches are less than 64 chars. 60 // Assume command line switches are less than 64 chars.
57 static const size_t kSwitchLen = 64; 61 static const size_t kSwitchLen = 64;
(...skipping 17 matching lines...) Expand all
75 // - extension: the id of each extension running in this process (there can be 79 // - extension: the id of each extension running in this process (there can be
76 // multiple because of process collapsing). 80 // multiple because of process collapsing).
77 void SetActiveExtensions(const std::set<std::string>& extension_ids); 81 void SetActiveExtensions(const std::set<std::string>& extension_ids);
78 82
79 // Sets a number of views/tabs opened in this process. 83 // Sets a number of views/tabs opened in this process.
80 void SetNumberOfViews(int number_of_views); 84 void SetNumberOfViews(int number_of_views);
81 85
82 // Sets the data on the gpu to send along with crash reports. 86 // Sets the data on the gpu to send along with crash reports.
83 void SetGpuInfo(const content::GPUInfo& gpu_info); 87 void SetGpuInfo(const content::GPUInfo& gpu_info);
84 88
89 // Sets the data on the printer to send along with crash reports. Data may be
90 // separated by ';' up to kMaxReportedPrinterRecords strings.
eroman 2012/03/14 02:12:49 There is also a limit on the length of these strin
Vitaly Buka (NO REVIEWS) 2012/03/14 20:37:42 Done.
91 void SetPrinterInfo(const char* printer_info);
92
85 // Sets the command line arguments to send along with crash reports to the 93 // Sets the command line arguments to send along with crash reports to the
86 // values in |command_line|. 94 // values in |command_line|.
87 void SetCommandLine(const CommandLine* command_line); 95 void SetCommandLine(const CommandLine* command_line);
88 96
89 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) 97 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX)
90 // Sets the product channel data to send along with crash reports to |channel|. 98 // Sets the product channel data to send along with crash reports to |channel|.
91 void SetChannel(const std::string& channel); 99 void SetChannel(const std::string& channel);
92 #endif 100 #endif
93 101
94 // Simple wrapper class that sets the active URL in it's constructor and clears 102 // Simple wrapper class that sets the active URL in it's constructor and clears
95 // the active URL in the destructor. 103 // the active URL in the destructor.
96 class ScopedActiveURLSetter { 104 class ScopedActiveURLSetter {
97 public: 105 public:
98 explicit ScopedActiveURLSetter(const GURL& url) { 106 explicit ScopedActiveURLSetter(const GURL& url) {
99 SetActiveURL(url); 107 SetActiveURL(url);
100 } 108 }
101 109
102 ~ScopedActiveURLSetter() { 110 ~ScopedActiveURLSetter() {
103 SetActiveURL(GURL()); 111 SetActiveURL(GURL());
104 } 112 }
105 113
106 private: 114 private:
107 DISALLOW_COPY_AND_ASSIGN(ScopedActiveURLSetter); 115 DISALLOW_COPY_AND_ASSIGN(ScopedActiveURLSetter);
108 }; 116 };
109 117
118 // Set/clear information about currently accessed printer.
119 class ScopedPrinterInfoSetter {
120 public:
121 explicit ScopedPrinterInfoSetter(const char* printer_info) {
122 SetPrinterInfo(printer_info);
123 }
124
125 ~ScopedPrinterInfoSetter() {
126 SetPrinterInfo("");
127 }
128
129 private:
130 DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfoSetter);
131 };
132
110 } // namespace child_process_logging 133 } // namespace child_process_logging
111 134
112 #if defined(OS_MACOSX) 135 #if defined(OS_MACOSX)
113 136
114 namespace child_process_logging { 137 namespace child_process_logging {
115 138
116 void SetActiveURLImpl(const GURL& url, 139 void SetActiveURLImpl(const GURL& url,
117 base::mac::SetCrashKeyValueFuncPtr set_key_func, 140 base::mac::SetCrashKeyValueFuncPtr set_key_func,
118 base::mac::ClearCrashKeyValueFuncPtr clear_key_func); 141 base::mac::ClearCrashKeyValueFuncPtr clear_key_func);
119 142
120 extern const int kMaxNumCrashURLChunks; 143 extern const int kMaxNumCrashURLChunks;
121 extern const int kMaxNumURLChunkValueLength; 144 extern const int kMaxNumURLChunkValueLength;
122 extern const char *kUrlChunkFormatStr; 145 extern const char *kUrlChunkFormatStr;
123 146
124 } // namespace child_process_logging 147 } // namespace child_process_logging
125 148
126 #endif // defined(OS_MACOSX) 149 #endif // defined(OS_MACOSX)
127 150
128 #endif // CHROME_COMMON_CHILD_PROCESS_LOGGING_H_ 151 #endif // CHROME_COMMON_CHILD_PROCESS_LOGGING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698