Changeset 232577 in webkit
- Timestamp:
- Jun 7, 2018 12:32:00 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r232574 r232577 1 2018-06-07 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [Win][MiniBrowser] Support multiple windows properly 4 https://bugs.webkit.org/show_bug.cgi?id=186263 5 6 Reviewed by Ryosuke Niwa. 7 8 The current implementation of 9 PrintWebUIDelegate::createWebViewWithRequest is wrong. It is using 10 CreateProcess to open a new window, and doesn't return the new 11 instance of IWebView. As the result, for example, window.close 12 doesn't work as expected. 13 14 In this change, a new MainWindow is created and return the 15 IWebView in PrintWebUIDelegate::createWebViewWithRequest. 16 17 In addition to it, this change unifies the lifetime of MiniBrowser 18 and its delegates AccessibilityDelegate, PrintWebUIDelegate, 19 ResourceLoadDelegate and WebDownloadDelegate in order to keep 20 MiniBrowser alive as long as the delegates live. Because the 21 window of webview keeps references of such delegates and accesses 22 those after MiniBrowser destruction. 23 24 * MiniBrowser/win/MainWindow.h: Added s_numInstances class member 25 to count the number of instance to close the application. Do not 26 use unique_ptr for m_browserWindow because it has ref count now. 27 * MiniBrowser/win/MainWindow.cpp: 28 (MainWindow::MainWindow): Increment s_numInstances. 29 (MainWindow::~MainWindow): Decrement s_numInstances. 30 (MainWindow::create): 31 (MainWindow::init): 32 (MainWindow::WndProc): Rename thiz to thisWindow. Keep this 33 instance alive during this function by using RefPtr<MainWindow>. 34 Deref the MainWindow instance on WM_DESTROY. Quit the application 35 when the last MainWindow is closed. 36 (MainWindow::cachesDialogProc): Rename thiz to thisWindow. 37 (MainWindow::customUserAgentDialogProc): Ditto. 38 * MiniBrowser/win/MiniBrowser.h: Added declarations AddRef and Release. 39 * MiniBrowser/win/MiniBrowser.cpp: 40 (MiniBrowser::create): 41 (MiniBrowser::AddRef): 42 (MiniBrowser::Release): 43 (MiniBrowser::init): Passes this to the constructors of delegates. 44 * MiniBrowser/win/AccessibilityDelegate.cpp: 45 (AccessibilityDelegate::AddRef): Delegate to MiniBrowser. 46 (AccessibilityDelegate::Release): Ditto. 47 * MiniBrowser/win/AccessibilityDelegate.h: Removed m_refCount. 48 (AccessibilityDelegate::AccessibilityDelegate): 49 * MiniBrowser/win/MiniBrowserWebHost.cpp: 50 (MiniBrowserWebHost::AddRef): Delegate to MiniBrowser. 51 (MiniBrowserWebHost::Release): Ditto. 52 * MiniBrowser/win/MiniBrowserWebHost.h: Removed m_refCount. 53 * MiniBrowser/win/PrintWebUIDelegate.cpp: 54 (PrintWebUIDelegate::createWebViewWithRequest): Create a new 55 MainWindow and return the IWebView. 56 (PrintWebUIDelegate::AddRef): Delegate to MiniBrowser. 57 (PrintWebUIDelegate::Release): Ditto. 58 * MiniBrowser/win/PrintWebUIDelegate.h: Removed m_refCount. 59 (PrintWebUIDelegate::PrintWebUIDelegate): 60 * MiniBrowser/win/ResourceLoadDelegate.cpp: 61 (ResourceLoadDelegate::AddRef): Delegate to MiniBrowser. 62 (ResourceLoadDelegate::Release): Ditto. 63 * MiniBrowser/win/ResourceLoadDelegate.h: Removed m_refCount. 64 * MiniBrowser/win/WebDownloadDelegate.cpp: 65 (WebDownloadDelegate::WebDownloadDelegate): 66 (WebDownloadDelegate::AddRef): Delegate to MiniBrowser. 67 (WebDownloadDelegate::Release): Ditto. 68 * MiniBrowser/win/WebDownloadDelegate.h: Removed m_refCount. 69 1 70 2018-06-06 Fujii Hironori <Hironori.Fujii@sony.com> 2 71 -
trunk/Tools/MiniBrowser/win/AccessibilityDelegate.cpp
r222194 r232577 27 27 #include "AccessibilityDelegate.h" 28 28 29 #include "MiniBrowser.h" 29 30 #include <WebKitLegacy/WebKitCOMAPI.h> 30 31 #include <commctrl.h> … … 53 54 ULONG AccessibilityDelegate::AddRef() 54 55 { 55 return ++m_refCount;56 return m_client.AddRef(); 56 57 } 57 58 58 59 ULONG AccessibilityDelegate::Release() 59 60 { 60 ULONG newRef = --m_refCount; 61 if (!newRef) 62 delete this; 63 64 return newRef; 61 return m_client.Release(); 65 62 } 66 63 -
trunk/Tools/MiniBrowser/win/AccessibilityDelegate.h
r222194 r232577 29 29 #include <WebKitLegacy/WebKit.h> 30 30 31 class MiniBrowser; 32 31 33 class AccessibilityDelegate : public IAccessibilityDelegate { 32 34 public: 33 AccessibilityDelegate() { } 35 AccessibilityDelegate(MiniBrowser& client) 36 : m_client(client) { } 34 37 virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject); 35 38 virtual ULONG STDMETHODCALLTYPE AddRef(); … … 39 42 virtual HRESULT STDMETHODCALLTYPE fireFrameLoadFinishedEvents(); 40 43 private: 41 int m_refCount { 1 };44 MiniBrowser& m_client; 42 45 }; 43 46 -
trunk/Tools/MiniBrowser/win/MainWindow.cpp
r232574 r232577 28 28 29 29 #include "Common.h" 30 #include "MiniBrowser.h"31 30 #include "MiniBrowserLibResource.h" 32 31 … … 43 42 44 43 std::wstring MainWindow::s_windowClass; 44 size_t MainWindow::s_numInstances; 45 45 46 46 static std::wstring loadString(int id) … … 78 78 } 79 79 80 MainWindow::MainWindow() 81 { 82 s_numInstances++; 83 } 84 85 MainWindow::~MainWindow() 86 { 87 s_numInstances--; 88 } 89 90 Ref<MainWindow> MainWindow::create() 91 { 92 return adoptRef(*new MainWindow()); 93 } 94 80 95 bool MainWindow::init(HINSTANCE hInstance, bool usesLayeredWebView, bool pageLoadTesting) 81 96 { … … 98 113 SetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(EditProc)); 99 114 100 m_browserWindow = std::make_unique<MiniBrowser>(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting);115 m_browserWindow = MiniBrowser::create(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting); 101 116 if (!m_browserWindow) 102 117 return false; … … 134 149 LRESULT CALLBACK MainWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 135 150 { 136 MainWindow& thiz = *reinterpret_cast<MainWindow*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));151 RefPtr<MainWindow> thisWindow = reinterpret_cast<MainWindow*>(GetWindowLongPtr(hWnd, GWLP_USERDATA)); 137 152 switch (message) { 138 153 case WM_CREATE: … … 150 165 } 151 166 if (wmId >= IDM_HISTORY_LINK0 && wmId <= IDM_HISTORY_LINK9) { 152 thi z.browserWindow()->navigateToHistory(hWnd, wmId);167 thisWindow->browserWindow()->navigateToHistory(hWnd, wmId); 153 168 break; 154 169 } … … 156 171 switch (wmId) { 157 172 case IDC_URL_BAR: 158 thi z.onURLBarEnter();173 thisWindow->onURLBarEnter(); 159 174 break; 160 175 case IDM_ABOUT: … … 165 180 break; 166 181 case IDM_PRINT: 167 thi z.browserWindow()->print();182 thisWindow->browserWindow()->print(); 168 183 break; 169 184 case IDM_WEB_INSPECTOR: 170 thi z.browserWindow()->launchInspector();185 thisWindow->browserWindow()->launchInspector(); 171 186 break; 172 187 case IDM_CACHES: 173 if (!::IsWindow(thi z.m_hCacheWnd)) {174 thi z.m_hCacheWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CACHES), hWnd, cachesDialogProc, reinterpret_cast<LPARAM>(&thiz));175 ::ShowWindow(thi z.m_hCacheWnd, SW_SHOW);188 if (!::IsWindow(thisWindow->m_hCacheWnd)) { 189 thisWindow->m_hCacheWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CACHES), hWnd, cachesDialogProc, reinterpret_cast<LPARAM>(thisWindow.get())); 190 ::ShowWindow(thisWindow->m_hCacheWnd, SW_SHOW); 176 191 } 177 192 break; 178 193 case IDM_HISTORY_BACKWARD: 179 194 case IDM_HISTORY_FORWARD: 180 thi z.browserWindow()->navigateForwardOrBackward(hWnd, wmId);195 thisWindow->browserWindow()->navigateForwardOrBackward(hWnd, wmId); 181 196 break; 182 197 case IDM_UA_OTHER: 183 DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_AGENT), hWnd, customUserAgentDialogProc, reinterpret_cast<LPARAM>( &thiz));198 DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_USER_AGENT), hWnd, customUserAgentDialogProc, reinterpret_cast<LPARAM>(thisWindow.get())); 184 199 break; 185 200 case IDM_ACTUAL_SIZE: 186 thi z.browserWindow()->resetZoom();201 thisWindow->browserWindow()->resetZoom(); 187 202 break; 188 203 case IDM_ZOOM_IN: 189 thi z.browserWindow()->zoomIn();204 thisWindow->browserWindow()->zoomIn(); 190 205 break; 191 206 case IDM_ZOOM_OUT: 192 thi z.browserWindow()->zoomOut();207 thisWindow->browserWindow()->zoomOut(); 193 208 break; 194 209 case IDM_SHOW_LAYER_TREE: 195 thi z.browserWindow()->showLayerTree();210 thisWindow->browserWindow()->showLayerTree(); 196 211 break; 197 212 default: 198 if (!thi z.toggleMenuItem(wmId))213 if (!thisWindow->toggleMenuItem(wmId)) 199 214 return DefWindowProc(hWnd, message, wParam, lParam); 200 215 } … … 202 217 break; 203 218 case WM_DESTROY: 219 SetWindowLongPtr(hWnd, GWLP_USERDATA, 0); 220 thisWindow->deref(); 221 if (s_numInstances > 1) 222 return 0; 204 223 #if USE(CF) 205 224 CFRunLoopStop(CFRunLoopGetMain()); … … 208 227 break; 209 228 case WM_SIZE: 210 thi z.resizeSubViews();229 thisWindow->resizeSubViews(); 211 230 break; 212 231 case WM_DPICHANGED: 213 thi z.browserWindow()->updateDeviceScaleFactor();232 thisWindow->browserWindow()->updateDeviceScaleFactor(); 214 233 return DefWindowProc(hWnd, message, wParam, lParam); 215 234 default: … … 317 336 INT_PTR CALLBACK MainWindow::cachesDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 318 337 { 319 MainWindow& thi z= *reinterpret_cast<MainWindow*>(GetWindowLongPtr(hDlg, DWLP_USER));338 MainWindow& thisWindow = *reinterpret_cast<MainWindow*>(GetWindowLongPtr(hDlg, DWLP_USER)); 320 339 switch (message) { 321 340 case WM_INITDIALOG: … … 328 347 ::KillTimer(hDlg, IDT_UPDATE_STATS); 329 348 ::DestroyWindow(hDlg); 330 thi z.m_hCacheWnd = 0;349 thisWindow.m_hCacheWnd = 0; 331 350 return (INT_PTR)TRUE; 332 351 } … … 338 357 339 358 case WM_PAINT: 340 thi z.browserWindow()->updateStatistics(hDlg);359 thisWindow.browserWindow()->updateStatistics(hDlg); 341 360 break; 342 361 } … … 347 366 INT_PTR CALLBACK MainWindow::customUserAgentDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 348 367 { 349 MainWindow& thi z= *reinterpret_cast<MainWindow*>(GetWindowLongPtr(hDlg, DWLP_USER));368 MainWindow& thisWindow = *reinterpret_cast<MainWindow*>(GetWindowLongPtr(hDlg, DWLP_USER)); 350 369 switch (message) { 351 370 case WM_INITDIALOG: { 352 MainWindow& thi z= *reinterpret_cast<MainWindow*>(lParam);371 MainWindow& thisWindow = *reinterpret_cast<MainWindow*>(lParam); 353 372 SetWindowLongPtr(hDlg, DWLP_USER, lParam); 354 373 HWND edit = ::GetDlgItem(hDlg, IDC_USER_AGENT_INPUT); 355 374 _bstr_t userAgent; 356 userAgent = thi z.browserWindow()->userAgent();375 userAgent = thisWindow.browserWindow()->userAgent(); 357 376 358 377 ::SetWindowText(edit, static_cast<LPCTSTR>(userAgent)); … … 370 389 _bstr_t bstr(buffer); 371 390 if (bstr.length()) { 372 thi z.browserWindow()->setUserAgent(bstr);373 thi z.toggleMenuItem(IDM_UA_OTHER);391 thisWindow.browserWindow()->setUserAgent(bstr); 392 thisWindow.toggleMenuItem(IDM_UA_OTHER); 374 393 } 375 394 } -
trunk/Tools/MiniBrowser/win/MainWindow.h
r232574 r232577 26 26 #pragma once 27 27 28 #include "MiniBrowser.h" 28 29 #include <memory> 29 30 #include <string> 31 #include <wtf/RefPtr.h> 30 32 31 class MiniBrowser; 33 class MainWindow : public RefCounted<MainWindow> { 34 public: 35 static Ref<MainWindow> create(); 32 36 33 class MainWindow { 34 public: 37 ~MainWindow(); 35 38 bool init(HINSTANCE hInstance, bool usesLayeredWebView = false, bool pageLoadTesting = false); 36 39 … … 47 50 static void registerClass(HINSTANCE hInstance); 48 51 static std::wstring s_windowClass; 52 static size_t s_numInstances; 49 53 54 MainWindow(); 50 55 bool toggleMenuItem(UINT menuID); 51 56 void onURLBarEnter(); … … 56 61 HWND m_hForwardButtonWnd { nullptr }; 57 62 HWND m_hCacheWnd { nullptr }; 58 std::unique_ptr<MiniBrowser> m_browserWindow;63 RefPtr<MiniBrowser> m_browserWindow; 59 64 }; -
trunk/Tools/MiniBrowser/win/MiniBrowser.cpp
r232270 r232577 61 61 typedef _com_ptr_t<_com_IIID<IWebMutableURLRequest, &__uuidof(IWebMutableURLRequest)>> IWebMutableURLRequestPtr; 62 62 63 Ref<MiniBrowser> MiniBrowser::create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting) 64 { 65 return adoptRef(*new MiniBrowser(mainWnd, urlBarWnd, useLayeredWebView, pageLoadTesting)); 66 } 67 63 68 MiniBrowser::MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting) 64 69 : m_hMainWnd(mainWnd) … … 69 74 } 70 75 76 ULONG MiniBrowser::AddRef() 77 { 78 ref(); 79 return refCount(); 80 } 81 82 ULONG MiniBrowser::Release() 83 { 84 auto count = refCount(); 85 deref(); 86 return --count; 87 } 88 71 89 HRESULT MiniBrowser::init() 72 90 { … … 112 130 return hr; 113 131 114 hr = setUIDelegate(new PrintWebUIDelegate( ));132 hr = setUIDelegate(new PrintWebUIDelegate(*this)); 115 133 if (FAILED (hr)) 116 134 return hr; 117 135 118 hr = setAccessibilityDelegate(new AccessibilityDelegate( ));136 hr = setAccessibilityDelegate(new AccessibilityDelegate(*this)); 119 137 if (FAILED (hr)) 120 138 return hr; … … 125 143 126 144 IWebDownloadDelegatePtr downloadDelegate; 127 downloadDelegate.Attach(new WebDownloadDelegate( ));145 downloadDelegate.Attach(new WebDownloadDelegate(*this)); 128 146 hr = setDownloadDelegate(downloadDelegate); 129 147 if (FAILED(hr)) -
trunk/Tools/MiniBrowser/win/MiniBrowser.h
r232333 r232577 30 30 #include <memory> 31 31 #include <vector> 32 #include <wtf/RefCounted.h> 32 33 33 34 typedef _com_ptr_t<_com_IIID<IWebFrame, &__uuidof(IWebFrame)>> IWebFramePtr; … … 48 49 typedef _com_ptr_t<_com_IIID<IWebFramePrivate, &__uuidof(IWebFramePrivate)>> IWebFramePrivatePtr; 49 50 50 class MiniBrowser {51 class MiniBrowser : public RefCounted<MiniBrowser> { 51 52 public: 52 MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); 53 static Ref<MiniBrowser> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); 54 55 ULONG AddRef(); 56 ULONG Release(); 53 57 54 58 HRESULT init(); … … 108 112 109 113 private: 114 MiniBrowser(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView, bool pageLoadTesting); 110 115 void subclassForLayeredWindow(); 111 116 void generateFontForScaleFactor(float); -
trunk/Tools/MiniBrowser/win/MiniBrowserWebHost.cpp
r232270 r232577 131 131 ULONG MiniBrowserWebHost::AddRef() 132 132 { 133 return ++m_refCount;133 return m_client->AddRef(); 134 134 } 135 135 136 136 ULONG MiniBrowserWebHost::Release() 137 137 { 138 ULONG newRef = --m_refCount; 139 if (!newRef) 140 delete(this); 141 142 return newRef; 138 return m_client->Release(); 143 139 } 144 140 -
trunk/Tools/MiniBrowser/win/MiniBrowserWebHost.h
r222194 r232577 81 81 HGDIOBJ m_URLBarFont { 0 }; 82 82 HGDIOBJ m_oldFont { 0 }; 83 ULONG m_refCount { 1 };84 83 MiniBrowser* m_client { nullptr }; 85 84 }; -
trunk/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp
r222194 r232577 28 28 #include "PrintWebUIDelegate.h" 29 29 30 #include "Common.h" 31 #include "MainWindow.h" 30 32 #if USE(CF) 31 33 #include <CoreFoundation/CoreFoundation.h> … … 62 64 return E_POINTER; 63 65 64 TCHAR executablePath[MAX_PATH]; 65 DWORD length = ::GetModuleFileName(GetModuleHandle(0), executablePath, ARRAYSIZE(executablePath)); 66 if (!length) 67 return E_FAIL; 68 69 _bstr_t url; 70 HRESULT hr = request->URL(&url.GetBSTR()); 71 if (FAILED(hr)) 72 return E_FAIL; 73 74 if (!url) 75 return S_OK; 76 77 std::wstring command = std::wstring(L"\"") + executablePath + L"\" " + (const wchar_t*)url; 78 79 PROCESS_INFORMATION processInformation; 80 STARTUPINFOW startupInfo; 81 memset(&startupInfo, 0, sizeof(startupInfo)); 82 if (!::CreateProcessW(0, (LPWSTR)command.c_str(), 0, 0, 0, 0, 0, 0, &startupInfo, &processInformation)) 83 return E_FAIL; 66 auto& newWindow = MainWindow::create().leakRef(); 67 bool ok = newWindow.init(hInst); 68 if (!ok) 69 return E_FAIL; 70 ShowWindow(newWindow.hwnd(), SW_SHOW); 71 72 *newWebView = newWindow.browserWindow()->webView(); 73 IWebFramePtr frame; 74 HRESULT hr; 75 hr = (*newWebView)->mainFrame(&frame.GetInterfacePtr()); 76 if (FAILED(hr)) 77 return hr; 78 hr = frame->loadRequest(request); 79 if (FAILED(hr)) 80 return hr; 84 81 85 82 return S_OK; … … 152 149 ULONG PrintWebUIDelegate::AddRef() 153 150 { 154 return ++m_refCount;151 return m_client.AddRef(); 155 152 } 156 153 157 154 ULONG PrintWebUIDelegate::Release() 158 155 { 159 ULONG newRef = --m_refCount; 160 if (!newRef) 161 delete this; 162 163 return newRef; 156 return m_client.Release(); 164 157 } 165 158 -
trunk/Tools/MiniBrowser/win/PrintWebUIDelegate.h
r222194 r232577 30 30 #include <WebKitLegacy/WebKit.h> 31 31 32 class MiniBrowser; 33 32 34 class PrintWebUIDelegate : public IWebUIDelegate { 33 35 public: 34 PrintWebUIDelegate() { } 36 PrintWebUIDelegate(MiniBrowser& client) 37 : m_client(client) { } 35 38 36 39 // IUnknown … … 104 107 105 108 private: 106 int m_refCount { 1 };109 MiniBrowser& m_client; 107 110 HWND m_modalDialogParent { nullptr }; 108 111 }; -
trunk/Tools/MiniBrowser/win/ResourceLoadDelegate.cpp
r232574 r232577 57 57 ULONG ResourceLoadDelegate::AddRef() 58 58 { 59 return ++m_refCount;59 return m_client->AddRef(); 60 60 } 61 61 62 62 ULONG ResourceLoadDelegate::Release() 63 63 { 64 ULONG newRef = --m_refCount; 65 if (!newRef) 66 delete this; 67 68 return newRef; 64 return m_client->Release(); 69 65 } 70 66 -
trunk/Tools/MiniBrowser/win/ResourceLoadDelegate.h
r222194 r232577 54 54 private: 55 55 MiniBrowser* m_client; 56 int m_refCount { 1 };57 56 }; 58 57 -
trunk/Tools/MiniBrowser/win/WebDownloadDelegate.cpp
r204892 r232577 29 29 #include "WebDownloadDelegate.h" 30 30 31 #include "MiniBrowser.h" 31 32 #include <shlobj.h> 32 33 33 WebDownloadDelegate::WebDownloadDelegate() 34 WebDownloadDelegate::WebDownloadDelegate(MiniBrowser& client) 35 : m_client(client) 34 36 { 35 37 } … … 58 60 ULONG WebDownloadDelegate::AddRef() 59 61 { 60 m_refCount++; 61 return m_refCount; 62 return m_client.AddRef(); 62 63 } 63 64 64 65 ULONG WebDownloadDelegate::Release() 65 66 { 66 m_refCount--; 67 int refCount = m_refCount; 68 if (!refCount) 69 delete this; 70 return refCount; 67 return m_client.Release(); 71 68 } 72 69 -
trunk/Tools/MiniBrowser/win/WebDownloadDelegate.h
r222194 r232577 30 30 #include <WebKitLegacy/WebKitCOMAPI.h> 31 31 32 class MiniBrowser; 33 32 34 class WebDownloadDelegate : public IWebDownloadDelegate { 33 35 public: 34 WebDownloadDelegate( );36 WebDownloadDelegate(MiniBrowser& client); 35 37 virtual ~WebDownloadDelegate(); 36 38 … … 53 55 54 56 private: 55 int m_refCount { 1 };57 MiniBrowser& m_client; 56 58 }; 57 59 -
trunk/Tools/MiniBrowser/win/WinMain.cpp
r232574 r232577 66 66 ::SetProcessDPIAware(); 67 67 68 auto mainWindow = new MainWindow();69 HRESULT hr = mainWindow ->init(hInst, usesLayeredWebView, pageLoadTesting);68 auto& mainWindow = MainWindow::create().leakRef(); 69 HRESULT hr = mainWindow.init(hInst, usesLayeredWebView, pageLoadTesting); 70 70 if (FAILED(hr)) 71 71 goto exit; 72 72 73 ShowWindow(mainWindow ->hwnd(), nCmdShow);73 ShowWindow(mainWindow.hwnd(), nCmdShow); 74 74 75 75 hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_MINIBROWSER)); 76 76 77 77 if (requestedURL.length()) 78 mainWindow ->loadURL(requestedURL.GetBSTR());78 mainWindow.loadURL(requestedURL.GetBSTR()); 79 79 else 80 mainWindow ->browserWindow()->loadHTMLString(_bstr_t(defaultHTML).GetBSTR());80 mainWindow.browserWindow()->loadHTMLString(_bstr_t(defaultHTML).GetBSTR()); 81 81 82 82 #pragma warning(disable:4509)
Note: See TracChangeset
for help on using the changeset viewer.