Revert 126866 - Added SetPrinterInfo to include information about printer...

Revert 126866 - Added SetPrinterInfo to include information about printer driver. This information will be added by Chrome (in different CL) just before performing error-prone printer related operations.

BUG=108194
TEST=none

Review URL: http://codereview.chromium.org/9600060

TBR=vitalybuka@chromium.org

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126878 0039d316-1c4b-4281-b951-d872f2087c98
parent 7d59f908
......@@ -574,19 +574,6 @@ void HandleCrashDump(const BreakpadInfo& info) {
false /* Don't strip whitespace. */);
}
unsigned printer_info_len =
my_strlen(child_process_logging::g_printer_info);
if (printer_info_len) {
static const char printer_info_msg[] = "prn-info-";
static const unsigned kMaxPrnInfoLen =
kMaxReportedPrinterRecords * child_process_logging::kPrinterInfoStrLen;
writer.AddPairDataInChunks(printer_info_msg, sizeof(printer_info_msg) - 1,
child_process_logging::g_printer_info,
std::min(printer_info_len, kMaxPrnInfoLen),
child_process_logging::kPrinterInfoStrLen,
true);
}
if (my_strlen(child_process_logging::g_num_switches)) {
writer.AddPairString("num-switches",
child_process_logging::g_num_switches);
......
......@@ -74,7 +74,6 @@ static size_t g_num_of_extensions_offset;
static size_t g_extension_ids_offset;
static size_t g_client_id_offset;
static size_t g_gpu_info_offset;
static size_t g_printer_info_offset;
static size_t g_num_of_views_offset;
static size_t g_num_switches_offset;
static size_t g_switches_offset;
......@@ -258,29 +257,19 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& exe_path,
base::StringPrintf(L"extension-%i", i + 1).c_str(), L""));
}
// Add empty values for the gpu_info. We'll put the actual values when we
// collect them at this location.
// Add empty values for the gpu_info. We'll put the actual values
// when we collect them at this location.
g_gpu_info_offset = g_custom_entries->size();
static const wchar_t* const kGpuEntries[] = {
L"gpu-venid",
L"gpu-devid",
L"gpu-driver",
L"gpu-psver",
L"gpu-vsver",
};
for (size_t i = 0; i < arraysize(kGpuEntries); ++i) {
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(kGpuEntries[i], L""));
}
// Add empty values for the prn_info-*. We'll put the actual values when we
// collect them at this location.
g_printer_info_offset = g_custom_entries->size();
for (size_t i = 0; i < kMaxReportedPrinterRecords; ++i) {
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(
base::StringPrintf(L"prn-info-%d", i + 1).c_str(), L""));
}
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"gpu-venid", L""));
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"gpu-devid", L""));
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"gpu-driver", L""));
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"gpu-psver", L""));
g_custom_entries->push_back(
google_breakpad::CustomInfoEntry(L"gpu-vsver", L""));
// Read the id from registry. If reporting has never been enabled
// the result will be empty string. Its OK since when user enables reporting
......@@ -498,34 +487,21 @@ extern "C" void __declspec(dllexport) __cdecl SetGpuInfo(
if (!g_custom_entries)
return;
const wchar_t* info[] = {
vendor_id,
device_id,
driver_version,
pixel_shader_version,
vertex_shader_version
};
for (size_t i = 0; i < arraysize(info); ++i) {
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset + i].value,
info[i],
google_breakpad::CustomInfoEntry::kValueMaxLength);
}
}
extern "C" void __declspec(dllexport) __cdecl SetPrinterInfo(
const wchar_t* printer_info) {
if (!g_custom_entries)
return;
std::vector<string16> info;
base::SplitString(printer_info, L';', &info);
DCHECK_LE(info.size(), kMaxReportedPrinterRecords);
info.resize(kMaxReportedPrinterRecords);
for (size_t i = 0; i < info.size(); ++i) {
base::wcslcpy((*g_custom_entries)[g_printer_info_offset + i].value,
info[i].c_str(),
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset].value,
vendor_id,
google_breakpad::CustomInfoEntry::kValueMaxLength);
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+1].value,
device_id,
google_breakpad::CustomInfoEntry::kValueMaxLength);
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+2].value,
driver_version,
google_breakpad::CustomInfoEntry::kValueMaxLength);
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+3].value,
pixel_shader_version,
google_breakpad::CustomInfoEntry::kValueMaxLength);
base::wcslcpy((*g_custom_entries)[g_gpu_info_offset+4].value,
vertex_shader_version,
google_breakpad::CustomInfoEntry::kValueMaxLength);
}
}
extern "C" void __declspec(dllexport) __cdecl SetNumberOfViews(
......
......@@ -24,9 +24,6 @@ struct GPUInfo;
// dependency.
static const int kMaxReportedActiveExtensions = 10;
// The maximum number of prn-info-* records.
static const size_t kMaxReportedPrinterRecords = 4;
// The maximum number of command line switches to include in the crash
// report's metadata. Note that the mini-dump itself will also contain the
// (original) command line arguments within the PEB.
......@@ -51,7 +48,6 @@ extern char g_gpu_vs_ver[];
extern char g_num_extensions[];
extern char g_num_switches[];
extern char g_num_views[];
extern char g_prn_info[];
extern char g_switches[];
// Assume IDs are 32 bytes long.
......@@ -59,9 +55,6 @@ static const size_t kExtensionLen = 32;
// Assume command line switches are less than 64 chars.
static const size_t kSwitchLen = 64;
// Assume printer info strings are less than 64 chars.
static const size_t kPrinterInfoStrLen = 64;
#endif
// Sets the URL that is logged if the child process crashes. Use GURL() to clear
......@@ -89,11 +82,6 @@ void SetNumberOfViews(int number_of_views);
// Sets the data on the gpu to send along with crash reports.
void SetGpuInfo(const content::GPUInfo& gpu_info);
// Sets the data on the printer to send along with crash reports. Data may be
// separated by ';' up to kMaxReportedPrinterRecords strings. Each substring
// would be cut to 63 chars.
void SetPrinterInfo(const char* printer_info);
// Sets the command line arguments to send along with crash reports to the
// values in |command_line|.
void SetCommandLine(const CommandLine* command_line);
......@@ -119,21 +107,6 @@ class ScopedActiveURLSetter {
DISALLOW_COPY_AND_ASSIGN(ScopedActiveURLSetter);
};
// Set/clear information about currently accessed printer.
class ScopedPrinterInfoSetter {
public:
explicit ScopedPrinterInfoSetter(const char* printer_info) {
SetPrinterInfo(printer_info);
}
~ScopedPrinterInfoSetter() {
SetPrinterInfo("");
}
private:
DISALLOW_COPY_AND_ASSIGN(ScopedPrinterInfoSetter);
};
} // namespace child_process_logging
#if defined(OS_MACOSX)
......
......@@ -8,7 +8,6 @@
#include "base/command_line.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
......@@ -37,7 +36,6 @@ const char *kGPUGLVersionParamName = "gpu-glver";
const char *kNumberOfViews = "num-views";
NSString* const kNumExtensionsName = @"num-extensions";
NSString* const kExtensionNameFormat = @"extension-%d";
NSString* const kPrinterInfoNameFormat = @"prn-info-%d";
// Account for the terminating null character.
static const size_t kClientIdSize = 32 + 1;
......@@ -165,19 +163,6 @@ void SetGpuInfo(const content::GPUInfo& gpu_info) {
SetGpuInfoImpl(gpu_info, SetCrashKeyValue);
}
void SetPrinterInfo(const char* printer_info) {
std::vector<std::string> info;
base::SplitString(printer_info, L';', &info);
info.resize(kMaxReportedPrinterRecords);
for (size_t i = 0; i < info.size(); ++i) {
NSString* key = [NSString stringWithFormat:kPrinterInfoNameFormat, i];
ClearCrashKey(key);
if (!info[i].empty()) {
NSString *value = [NSString stringWithUTF8String:info[i].c_str()];
SetCrashKeyValue(key, value);
}
}
}
void SetNumberOfViewsImpl(int number_of_views,
SetCrashKeyValueFuncPtr set_key_func) {
......
......@@ -7,7 +7,6 @@
#include "base/command_line.h"
#include "base/format_macros.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/installer/util/google_update_settings.h"
......@@ -30,14 +29,13 @@ char g_client_id[kClientIdSize];
char g_channel[kChannelSize] = "";
static const size_t kGpuStringSize = 32;
char g_gpu_vendor_id[kGpuStringSize] = "";
char g_gpu_device_id[kGpuStringSize] = "";
char g_gpu_driver_ver[kGpuStringSize] = "";
char g_gpu_ps_ver[kGpuStringSize] = "";
char g_gpu_vs_ver[kGpuStringSize] = "";
char g_printer_info[kPrinterInfoStrLen * kMaxReportedPrinterRecords + 1] = "";
static const size_t kNumSize = 32;
char g_num_extensions[kNumSize] = "";
char g_num_switches[kNumSize] = "";
......@@ -105,22 +103,6 @@ void SetGpuInfo(const content::GPUInfo& gpu_info) {
g_gpu_vs_ver[kGpuStringSize - 1] = '\0';
}
void SetPrinterInfo(const char* printer_info) {
std::string printer_info_str;
std::vector<std::string> info;
base::SplitString(printer_info, L';', &info);
DCHECK_LE(info.size(), kMaxReportedPrinterRecords);
info.resize(kMaxReportedPrinterRecords);
for (size_t i = 0; i < info.size(); ++i) {
printer_info_str += info[i];
// Truncate long switches, align short ones with spaces to be trimmed later.
printer_info_str.resize((i + 1) * kPrinterInfoStrLen, ' ');
}
strncpy(g_printer_info, printer_info_str.c_str(),
arraysize(g_printer_info) - 1);
g_printer_info[arraysize(g_printer_info) - 1] = '\0';
}
void SetNumberOfViews(int number_of_views) {
snprintf(g_num_views, kNumSize - 1, "%d", number_of_views);
g_num_views[kNumSize - 1] = '\0';
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -36,10 +36,6 @@ typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*,
const wchar_t*, const wchar_t*,
const wchar_t*);
// exported in breakpad_win.cc:
// void __declspec(dllexport) __cdecl SetPrinterInfo.
typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*);
// exported in breakpad_win.cc:
// void __declspec(dllexport) __cdecl SetNumberOfViews.
typedef void (__cdecl *MainSetNumberOfViews)(int);
......@@ -154,20 +150,6 @@ void SetGpuInfo(const content::GPUInfo& gpu_info) {
UTF8ToUTF16(gpu_info.vertex_shader_version).c_str());
}
void SetPrinterInfo(const char* printer_info) {
static MainSetPrinterInfo set_printer_info = NULL;
if (!set_printer_info) {
HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
if (!exe_module)
return;
set_printer_info = reinterpret_cast<MainSetPrinterInfo>(
GetProcAddress(exe_module, "SetPrinterInfo"));
if (!set_printer_info)
return;
}
(set_printer_info)(UTF8ToWide(printer_info).c_str());
}
void SetCommandLine(const CommandLine* command_line) {
static MainSetCommandLine set_command_line = NULL;
if (!set_command_line) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment