Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.

Commit 3a94d66

Browse files
committed
Replaced util macros in favour of cef_helpers ones
1 parent 58a7d05 commit 3a94d66

12 files changed

+29
-69
lines changed

appshell/appshell_node_process_mac.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "appshell_node_process.h"
2828
#include "appshell_node_process_internal.h"
2929

30-
#include "util.h"
3130
#include "config.h"
3231

3332
// NOTE ON THREAD SAFETY: This code is not thread-safe. All of the methods

appshell/cef_registry.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#endif
2727

2828
#include "config.h"
29-
#include "util.h"
29+
#include "include/wrapper/cef_helpers.h"
3030

3131
static const wchar_t g_szSoftwareFolder[] = L"Software";
3232

@@ -49,7 +49,7 @@ void EnsureTrailingSeparator(LPWSTR pRet)
4949
void GetKey(LPCWSTR pBase, LPCWSTR pGroup, LPCWSTR pApp, LPCWSTR pFolder, LPWSTR pRet)
5050
{
5151
// Check for required params
52-
ASSERT(pBase && pApp && pRet);
52+
DCHECK(pBase && pApp && pRet);
5353
if (!pBase || !pApp || !pRet)
5454
return;
5555

@@ -94,8 +94,8 @@ bool GetRegistryInt(LPCWSTR pFolder, LPCWSTR pEntry, int* pDefault, int& ret)
9494
if (ERROR_SUCCESS == RegQueryValueEx(hKey, pEntry, NULL, &dwType, (LPBYTE)&dwValue, &dwCount))
9595
{
9696
result = true;
97-
ASSERT(dwType == REG_DWORD);
98-
ASSERT(dwCount == sizeof(dwValue));
97+
DCHECK(dwType == REG_DWORD);
98+
DCHECK(dwCount == sizeof(dwValue));
9999
ret = (int)dwValue;
100100
}
101101
RegCloseKey(hKey);

appshell/cefclient.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#include "include/cef_frame.h"
1414
#include "include/cef_runnable.h"
1515
#include "include/cef_web_plugin.h"
16+
#include "include/wrapper/cef_helpers.h"
1617
#include "client_handler.h"
1718
#include "client_switches.h"
1819
#include "string_util.h"
19-
#include "util.h"
2020
#include "config.h"
2121

2222
CefRefPtr<ClientHandler> g_handler;
@@ -50,8 +50,8 @@ CefRefPtr<CefCommandLine> AppGetCommandLine() {
5050

5151
// Returns the application settings based on command line arguments.
5252
void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
53-
ASSERT(app.get());
54-
ASSERT(g_command_line.get());
53+
DCHECK(app.get());
54+
DCHECK(g_command_line.get());
5555
if (!g_command_line.get())
5656
return;
5757

appshell/client_app.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "include/cef_process_message.h"
1212
#include "include/cef_task.h"
1313
#include "include/cef_v8.h"
14-
#include "util.h" // NOLINT(build/include)
14+
#include "include/wrapper/cef_helpers.h"
1515
#include "config.h"
1616

1717
namespace {
@@ -40,7 +40,7 @@ void SetListValue(CefRefPtr<CefListValue> list, int index,
4040

4141
// Transfer a V8 array to a List.
4242
void SetList(CefRefPtr<CefV8Value> source, CefRefPtr<CefListValue> target) {
43-
ASSERT(source->IsArray());
43+
DCHECK(source->IsArray());
4444

4545
int arg_length = source->GetArrayLength();
4646
if (arg_length == 0)
@@ -121,7 +121,7 @@ void SetListValue(CefRefPtr<CefV8Value> list, int index,
121121

122122
// Transfer a List to a V8 array.
123123
void SetList(CefRefPtr<CefListValue> source, CefRefPtr<CefV8Value> target) {
124-
ASSERT(target->IsArray());
124+
DCHECK(target->IsArray());
125125

126126
int arg_length = source->GetSize();
127127
if (arg_length == 0)
@@ -299,7 +299,7 @@ bool ClientApp::OnProcessMessageReceived(
299299
CefRefPtr<CefBrowser> browser,
300300
CefProcessId source_process,
301301
CefRefPtr<CefProcessMessage> message) {
302-
ASSERT(source_process == PID_BROWSER);
302+
DCHECK(source_process == PID_BROWSER);
303303

304304
bool handled = false;
305305

appshell/client_handler.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "include/cef_browser.h"
1010
#include "include/cef_frame.h"
1111
#include "include/wrapper/cef_stream_resource_handler.h"
12+
#include "include/wrapper/cef_helpers.h"
1213
#include "cefclient.h"
1314
#include "resource_util.h"
1415
#include "string_util.h"
@@ -149,7 +150,7 @@ bool ClientHandler::OnBeforePopup(CefRefPtr<CefBrowser> browser,
149150
}
150151

151152
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
152-
REQUIRE_UI_THREAD();
153+
CEF_REQUIRE_UI_THREAD();
153154

154155
AutoLock lock_scope(this);
155156
if (!m_Browser.get()) {
@@ -165,7 +166,7 @@ void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
165166
}
166167

167168
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
168-
REQUIRE_UI_THREAD();
169+
CEF_REQUIRE_UI_THREAD();
169170

170171
if (CanCloseBrowser(browser)) {
171172
if (m_BrowserId == browser->GetIdentifier()) {
@@ -191,7 +192,7 @@ std::vector<CefString> gDroppedFiles;
191192
bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
192193
CefRefPtr<CefDragData> dragData,
193194
DragOperationsMask mask) {
194-
REQUIRE_UI_THREAD();
195+
CEF_REQUIRE_UI_THREAD();
195196

196197
if (dragData->IsFile()) {
197198
gDroppedFiles.clear();
@@ -203,7 +204,7 @@ bool ClientHandler::OnDragEnter(CefRefPtr<CefBrowser> browser,
203204

204205
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
205206
CefRefPtr<CefFrame> frame) {
206-
REQUIRE_UI_THREAD();
207+
CEF_REQUIRE_UI_THREAD();
207208

208209
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
209210
// We've just started loading a page
@@ -214,7 +215,7 @@ void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
214215
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
215216
CefRefPtr<CefFrame> frame,
216217
int httpStatusCode) {
217-
REQUIRE_UI_THREAD();
218+
CEF_REQUIRE_UI_THREAD();
218219

219220
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
220221
// We've just finished loading a page
@@ -227,7 +228,7 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
227228
ErrorCode errorCode,
228229
const CefString& errorText,
229230
const CefString& failedUrl) {
230-
REQUIRE_UI_THREAD();
231+
CEF_REQUIRE_UI_THREAD();
231232

232233
// Display a load error message.
233234
std::stringstream ss;
@@ -269,7 +270,7 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
269270
bool isLoading,
270271
bool canGoBack,
271272
bool canGoForward) {
272-
REQUIRE_UI_THREAD();
273+
CEF_REQUIRE_UI_THREAD();
273274
SetLoading(isLoading);
274275
SetNavState(canGoBack, canGoForward);
275276
}

appshell/client_handler.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <string>
1212
#include "include/base/cef_lock.h"
1313
#include "include/cef_client.h"
14-
#include "util.h"
1514
#include "command_callbacks.h"
1615

1716
#include <algorithm>

appshell/client_handler_win.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <string>
88
#include "include/cef_browser.h"
99
#include "include/cef_frame.h"
10+
#include "include/wrapper/cef_helpers.h"
1011
#include "resource.h"
1112
#include "native_menu_model.h"
1213

@@ -24,12 +25,12 @@ extern HACCEL hAccelTable;
2425
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
2526
CefRefPtr<CefFrame> frame,
2627
const CefString& url) {
27-
REQUIRE_UI_THREAD();
28+
CEF_REQUIRE_UI_THREAD();
2829
}
2930

3031
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
3132
const CefString& title) {
32-
REQUIRE_UI_THREAD();
33+
CEF_REQUIRE_UI_THREAD();
3334

3435
// Set the frame window title bar
3536
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();

appshell/resource_util_linux.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <stdio.h>
88
#include <string>
99
#include "include/cef_stream.h"
10-
#include "util.h"
1110

1211
bool GetResourceDir(std::string& dir) {
1312
char buff[1024];

appshell/resource_util_mac.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <stdio.h>
99
#include "resource_util.h"
1010
#include "include/cef_stream.h"
11-
#include "util.h"
11+
#include "include/wrapper/cef_helpers.h"
1212

1313
namespace {
1414

@@ -19,15 +19,15 @@ bool AmIBundled() {
1919
FSRef fsref;
2020
OSStatus pbErr;
2121
if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) {
22-
ASSERT(false);
22+
DCHECK(false);
2323
return false;
2424
}
2525

2626
FSCatalogInfo info;
2727
OSErr fsErr;
2828
if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info,
2929
NULL, NULL, NULL)) != noErr) {
30-
ASSERT(false);
30+
DCHECK(false);
3131
return false;
3232
}
3333

@@ -52,7 +52,7 @@ bool GetResourceDir(std::string& dir) {
5252
return true;
5353
} else {
5454
// TODO: Provide unbundled path
55-
ASSERT(false);
55+
DCHECK(false);
5656
return false;
5757
}
5858
}

appshell/resource_util_win.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "resource_util.h"
66
#include "include/cef_stream.h"
77
#include "include/wrapper/cef_byte_read_handler.h"
8-
#include "util.h"
8+
#include "include/wrapper/cef_helpers.h"
99

1010
#if defined(OS_WIN)
1111

@@ -35,7 +35,7 @@ CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) {
3535
new CefByteReadHandler(pBytes, dwSize, NULL));
3636
}
3737

38-
ASSERT(FALSE); // The resource should be found.
38+
DCHECK(FALSE); // The resource should be found.
3939
return NULL;
4040
}
4141

@@ -57,7 +57,7 @@ CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
5757
return GetBinaryResourceReader(resource_map[i].id);
5858
}
5959

60-
ASSERT(FALSE); // The resource should be found.
60+
DCHECK(FALSE); // The resource should be found.
6161
return NULL;
6262
}
6363

0 commit comments

Comments
 (0)