Merge pull request #286 from electron/cleanup-cpp

Cleanup codebase
This commit is contained in:
Kevin Sawicki 2017-04-03 08:26:32 -07:00 committed by GitHub
commit 7dce066854
10 changed files with 11 additions and 15 deletions

View file

@ -23,7 +23,7 @@ namespace {
BrowserClient* g_browser_client; BrowserClient* g_browser_client;
} } // namespace
BrowserClient* BrowserClient::Get() { BrowserClient* BrowserClient::Get() {
return g_browser_client; return g_browser_client;

View file

@ -54,8 +54,6 @@
#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h" #include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h"
#endif #endif
using content::BrowserThread;
namespace brightray { namespace brightray {
namespace { namespace {
@ -107,7 +105,7 @@ NOINLINE void WaitingForUIThreadToHandleIOError() {
} }
int BrowserX11IOErrorHandler(Display* d) { int BrowserX11IOErrorHandler(Display* d) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
// Wait for the UI thread (which has a different connection to the X server) // Wait for the UI thread (which has a different connection to the X server)
// to get the error. We can't call shutdown from this thread without // to get the error. We can't call shutdown from this thread without
// tripping an error. Doing it through a function so that we'll be able // tripping an error. Doing it through a function so that we'll be able

View file

@ -19,4 +19,4 @@ void BrowserMainParts::InitializeMainNib() {
[mainNib release]; [mainNib release];
} }
} } // namespace brightray

View file

@ -205,7 +205,7 @@ vector<FilePath> Index::Search(string query) {
vector<FilePath> result; vector<FilePath> result;
FileIdsMap::const_iterator ids_it = file_ids_.begin(); FileIdsMap::const_iterator ids_it = file_ids_.begin();
for (; ids_it != file_ids_.end(); ++ids_it) { for (; ids_it != file_ids_.end(); ++ids_it) {
if (trigrams.size() == 0 || if (trigrams.empty() ||
file_ids.find(ids_it->second) != file_ids.end()) { file_ids.find(ids_it->second) != file_ids.end()) {
result.push_back(ids_it->first); result.push_back(ids_it->first);
} }

View file

@ -56,4 +56,4 @@ void InspectableWebContentsViewMac::SetTitle(const base::string16& title) {
[view_ setTitle:base::SysUTF16ToNSString(title)]; [view_ setTitle:base::SysUTF16ToNSString(title)];
} }
} } // namespace brightray

View file

@ -8,8 +8,6 @@
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
using namespace brightray;
@implementation BRYInspectableWebContentsView @implementation BRYInspectableWebContentsView
- (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view { - (instancetype)initWithInspectableWebContentsViewMac:(InspectableWebContentsViewMac*)view {

View file

@ -67,7 +67,7 @@ DevToolsNetworkInterceptor*
DevToolsNetworkController::GetInterceptor(const std::string& client_id) { DevToolsNetworkController::GetInterceptor(const std::string& client_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!interceptors_.size() || client_id.empty()) if (interceptors_.empty() || client_id.empty())
return nullptr; return nullptr;
DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id); DevToolsNetworkInterceptor* interceptor = interceptors_.get(client_id);

View file

@ -108,7 +108,7 @@ uint64_t DevToolsNetworkInterceptor::UpdateThrottledRecords(
uint64_t last_tick, uint64_t last_tick,
base::TimeDelta tick_length) { base::TimeDelta tick_length) {
if (tick_length.is_zero()) { if (tick_length.is_zero()) {
DCHECK(!records->size()); DCHECK(records->empty());
return last_tick; return last_tick;
} }
@ -195,7 +195,7 @@ base::TimeTicks DevToolsNetworkInterceptor::CalculateDesiredTime(
void DevToolsNetworkInterceptor::ArmTimer(base::TimeTicks now) { void DevToolsNetworkInterceptor::ArmTimer(base::TimeTicks now) {
size_t suspend_count = suspended_.size(); size_t suspend_count = suspended_.size();
if (!download_.size() && !upload_.size() && !suspend_count) { if (download_.empty() && upload_.empty() && !suspend_count) {
timer_.Stop(); timer_.Stop();
return; return;
} }

View file

@ -16,7 +16,7 @@ namespace {
const char kChromeUIDevToolsBundledHost[] = "devtools"; const char kChromeUIDevToolsBundledHost[] = "devtools";
} } // namespace
// static // static
WebUIControllerFactory* WebUIControllerFactory::GetInstance() { WebUIControllerFactory* WebUIControllerFactory::GetInstance() {

View file

@ -17,7 +17,7 @@ std::string ApplicationInfoDictionaryValue(CFStringRef key) {
return ApplicationInfoDictionaryValue(base::mac::CFToNSCast(key)); return ApplicationInfoDictionaryValue(base::mac::CFToNSCast(key));
} }
} } // namespace
std::string GetApplicationName() { std::string GetApplicationName() {
return ApplicationInfoDictionaryValue(kCFBundleNameKey); return ApplicationInfoDictionaryValue(kCFBundleNameKey);
@ -27,4 +27,4 @@ std::string GetApplicationVersion() {
return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString"); return ApplicationInfoDictionaryValue(@"CFBundleShortVersionString");
} }
} } // namespace brightray