Skip to content

Commit a6c5dd8

Browse files
committed
Merge branch 'rb32' of /cygdrive/y/nw9/src/content/nw/ into rb32
Conflicts: src/browser/shell_devtools_delegate.cc src/browser/shell_devtools_delegate.h src/chrome_breakpad_client.cc
2 parents 1a91caa + c14509f commit a6c5dd8

11 files changed

+106
-45
lines changed

src/breakpad_mac.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import "chrome/app/breakpad_mac.h"
5+
#import "components/breakpad/app/breakpad_mac.h"
66

77
#include <CoreFoundation/CoreFoundation.h>
88
#import <Foundation/Foundation.h>
@@ -25,7 +25,7 @@
2525
#import "breakpad/src/client/mac/Framework/Breakpad.h"
2626
#include "chrome/common/child_process_logging.h"
2727
#include "content/public/common/content_switches.h"
28-
#include "components/breakpad/breakpad_client.h"
28+
#include "components/breakpad/app/breakpad_client.h"
2929
#include "content/nw/src/paths_mac.h"
3030
//#include "policy/policy_constants.h"
3131

@@ -250,7 +250,7 @@ void InitCrashReporter() {
250250
// Get the guid from the command line switch.
251251
std::string guid =
252252
command_line->GetSwitchValueASCII(switches::kEnableCrashReporter);
253-
child_process_logging::SetClientId(guid);
253+
breakpad::GetBreakpadClient()->SetClientID(guid);
254254
}
255255

256256
logging::SetLogMessageHandler(&FatalMessageHandler);

src/browser/shell_devtools_delegate.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ std::string ShellDevToolsDelegate::GetPageThumbnailData(const GURL& url) {
6868
return "";
6969
}
7070

71-
#if 0
72-
std::string ShellDevToolsDelegate::GetViewDescription(
73-
content::RenderViewHost*) {
74-
return std::string();
75-
}
76-
#endif
77-
7871
scoped_ptr<net::StreamListenSocket>
7972
ShellDevToolsDelegate::CreateSocketForTethering(
8073
net::StreamListenSocket::Delegate* delegate,
@@ -84,8 +77,6 @@ ShellDevToolsDelegate::CreateSocketForTethering(
8477

8578
const char kTargetTypePage[] = "page";
8679

87-
std::string GetViewDescription(WebContents* web_contents);
88-
8980
class Target : public content::DevToolsTarget {
9081
public:
9182
explicit Target(WebContents* web_contents);

src/browser/shell_devtools_delegate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class ShellDevToolsDelegate : public DevToolsHttpHandlerDelegate {
5454
virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE;
5555
virtual scoped_ptr<DevToolsTarget> CreateNewTarget(const GURL& url) OVERRIDE;
5656
virtual void EnumerateTargets(TargetCallback callback) OVERRIDE;
57-
// virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE;
5857
virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
5958
net::StreamListenSocket::Delegate* delegate,
6059
std::string* name) OVERRIDE;

src/chrome_breakpad_client.cc

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ bool ChromeBreakpadClient::AboutToRestart() {
150150
return true;
151151
}
152152

153-
#if 0
154-
base::string16 ChromeBreakpadClient::GetCrashGUID() {
155-
std::wstring guid;
156-
// GoogleUpdateSettings::GetMetricsId(&guid);
157-
return base::WideToUTF16(guid);
158-
}
159-
#endif
160-
161153
bool ChromeBreakpadClient::GetDeferredUploadsSupported(bool) {
162154
return false;
163155
}
@@ -173,6 +165,86 @@ bool ChromeBreakpadClient::GetShouldDumpLargerDumps(bool is_per_user_install) {
173165
int ChromeBreakpadClient::GetResultCodeRespawnFailed() {
174166
return chrome::RESULT_CODE_RESPAWN_FAILED;
175167
}
168+
169+
void ChromeBreakpadClient::InitBrowserCrashDumpsRegKey() {
170+
DCHECK(g_browser_crash_dump_regkey == NULL);
171+
172+
base::win::RegKey regkey;
173+
if (regkey.Create(HKEY_CURRENT_USER,
174+
chrome::kBrowserCrashDumpAttemptsRegistryPath,
175+
KEY_ALL_ACCESS) != ERROR_SUCCESS) {
176+
return;
177+
}
178+
179+
// We use the current process id and the current tick count as a (hopefully)
180+
// unique combination for the crash dump value. There's a small chance that
181+
// across a reboot we might have a crash dump signal written, and the next
182+
// browser process might have the same process id and tick count, but crash
183+
// before consuming the signal (overwriting the signal with an identical one).
184+
// For now, we're willing to live with that risk.
185+
int length = base::strings::SafeSPrintf(g_browser_crash_dump_prefix,
186+
kBrowserCrashDumpPrefixTemplate,
187+
chrome::kChromeVersion,
188+
::GetCurrentProcessId(),
189+
::GetTickCount());
190+
if (length <= 0) {
191+
NOTREACHED();
192+
g_browser_crash_dump_prefix[0] = '\0';
193+
return;
194+
}
195+
196+
// Hold the registry key in a global for update on crash dump.
197+
g_browser_crash_dump_regkey = regkey.Take();
198+
}
199+
200+
void ChromeBreakpadClient::RecordCrashDumpAttempt(bool is_real_crash) {
201+
// If we're not a browser (or the registry is unavailable to us for some
202+
// reason) then there's nothing to do.
203+
if (g_browser_crash_dump_regkey == NULL)
204+
return;
205+
206+
// Generate the final value name we'll use (appends the crash number to the
207+
// base value name).
208+
const size_t kMaxValueSize = 2 * kBrowserCrashDumpPrefixLength;
209+
char value_name[kMaxValueSize + 1] = {};
210+
int length = base::strings::SafeSPrintf(
211+
value_name,
212+
"%s-%x",
213+
g_browser_crash_dump_prefix,
214+
base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1));
215+
216+
if (length > 0) {
217+
DWORD value_dword = is_real_crash ? 1 : 0;
218+
::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD,
219+
reinterpret_cast<BYTE*>(&value_dword),
220+
sizeof(value_dword));
221+
}
222+
}
223+
224+
bool ChromeBreakpadClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
225+
// Determine whether configuration management allows loading the crash reporter.
226+
// Since the configuration management infrastructure is not initialized at this
227+
// point, we read the corresponding registry key directly. The return status
228+
// indicates whether policy data was successfully read. If it is true,
229+
// |breakpad_enabled| contains the value set by policy.
230+
string16 key_name = UTF8ToUTF16(policy::key::kMetricsReportingEnabled);
231+
DWORD value = 0;
232+
base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE,
233+
policy::kRegistryChromePolicyKey, KEY_READ);
234+
if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
235+
*breakpad_enabled = value != 0;
236+
return true;
237+
}
238+
239+
base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER,
240+
policy::kRegistryChromePolicyKey, KEY_READ);
241+
if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
242+
*breakpad_enabled = value != 0;
243+
return true;
244+
}
245+
246+
return false;
247+
}
176248
#endif
177249

178250
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)

src/chrome_breakpad_client.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class ChromeBreakpadClient : public breakpad::BreakpadClient {
3030
base::string16* message,
3131
bool* is_rtl_locale) OVERRIDE;
3232
virtual bool AboutToRestart() OVERRIDE;
33-
virtual base::string16 GetCrashGUID() OVERRIDE;
3433
virtual bool GetDeferredUploadsSupported(bool is_per_user_install) OVERRIDE;
3534
virtual bool GetIsPerUserInstall(const base::FilePath& exe_path) OVERRIDE;
3635
virtual bool GetShouldDumpLargerDumps(bool is_per_user_install) OVERRIDE;
3736
virtual int GetResultCodeRespawnFailed() OVERRIDE;
37+
virtual void InitBrowserCrashDumpsRegKey() OVERRIDE;
38+
virtual void RecordCrashDumpAttempt(bool is_real_crash) OVERRIDE;
3839
#endif
3940

4041
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
@@ -55,6 +56,10 @@ class ChromeBreakpadClient : public breakpad::BreakpadClient {
5556

5657
virtual bool GetCollectStatsConsent() OVERRIDE;
5758

59+
#if defined(OS_WIN) || defined(OS_MACOSX)
60+
virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) OVERRIDE;
61+
#endif
62+
5863
#if defined(OS_ANDROID)
5964
virtual int GetAndroidMinidumpDescriptor() OVERRIDE;
6065
#endif

src/chrome_breakpad_client_mac.mm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@
44

55
#include "chrome/app/chrome_breakpad_client.h"
66

7+
#include <CoreFoundation/CoreFoundation.h>
8+
79
#include "base/command_line.h"
10+
#include "base/mac/scoped_cftyperef.h"
11+
#include "base/strings/sys_string_conversions.h"
812
#include "chrome/common/chrome_switches.h"
13+
//#include "policy/policy_constants.h"
14+
915

1016
namespace chrome {
1117

1218
void ChromeBreakpadClient::InstallAdditionalFilters(BreakpadRef breakpad) {
1319
}
1420

21+
bool ChromeBreakpadClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
22+
return false;
23+
}
24+
1525
} // namespace chrome

src/mac/app-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>0.8.3</string>
22+
<string>0.9.0</string>
2323
<key>NSPrincipalClass</key>
2424
<string>NSApplication</string>
2525
<key>LSMinimumSystemVersion</key>

src/nw_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#define NW_VERSION_H
2323

2424
#define NW_MAJOR_VERSION 0
25-
#define NW_MINOR_VERSION 8
26-
#define NW_PATCH_VERSION 3
25+
#define NW_MINOR_VERSION 9
26+
#define NW_PATCH_VERSION 0
2727
#define NW_VERSION_IS_RELEASE 0
2828

2929
#ifndef NW_STRINGIFY

src/renderer/printing/print_web_view_helper_mac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
params.display_header_footer ? gfx::Rect(*page_size) : content_area;
119119

120120
{
121-
SkDevice* device = metafile->StartPageForVectorCanvas(
121+
SkBaseDevice* device = metafile->StartPageForVectorCanvas(
122122
*page_size, canvas_area, scale_factor);
123123
if (!device)
124124
return;

src/shell_content_browser_client.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
#include "base/strings/string_number_conversions.h"
2929
#include "base/threading/thread_restrictions.h"
3030
#include "base/values.h"
31-
#include "chrome/common/child_process_logging.h"
31+
//#include "chrome/common/child_process_logging.h"
32+
#include "components/breakpad/app/breakpad_client.h"
3233
#include "content/browser/child_process_security_policy_impl.h"
3334
#include "content/browser/gpu/compositor_util.h"
3435
#include "content/nw/src/browser/printing/printing_message_filter.h"
@@ -151,8 +152,7 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
151152
int child_process_id) {
152153
#if defined(OS_MACOSX)
153154
if (IsCrashReporterEnabled()) {
154-
command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
155-
child_process_logging::GetClientId());
155+
command_line->AppendSwitch(switches::kEnableCrashReporter);
156156
}
157157
#elif defined(OS_POSIX)
158158
if (IsCrashReporterEnabled()) {

0 commit comments

Comments
 (0)