@@ -30,48 +30,48 @@ public partial class OutOfProcessChromiumWebBrowser : IWebBrowserInternal
3030 /// <summary>
3131 /// The managed cef browser adapter
3232 /// </summary>
33- private IBrowserAdapter managedCefBrowserAdapter ;
33+ private IBrowserAdapter _managedCefBrowserAdapter ;
3434
3535 /// <summary>
3636 /// JSON RPC used for IPC with host
3737 /// </summary>
38- private IOutOfProcessHostRpc outOfProcessServer ;
38+ private IOutOfProcessHostRpc _outofProcessHostRpc ;
3939
4040 /// <summary>
4141 /// Flag to guard the creation of the underlying browser - only one instance can be created
4242 /// </summary>
43- private bool browserCreated ;
43+ private bool _browserCreated ;
4444
4545 /// <summary>
4646 /// Used as workaround for issue https://github.com/cefsharp/CefSharp/issues/3021
4747 /// </summary>
48- private long canExecuteJavascriptInMainFrameId ;
48+ private long _canExecuteJavascriptInMainFrameId ;
4949
5050 /// <summary>
5151 /// The browser initialized - boolean represented as 0 (false) and 1(true) as we use Interlocker to increment/reset
5252 /// </summary>
53- private int browserInitialized ;
53+ private int _browserInitialized ;
5454
5555 /// <summary>
5656 /// The value for disposal, if it's 1 (one) then this instance is either disposed
5757 /// or in the process of getting disposed
5858 /// </summary>
59- private int disposeSignaled ;
59+ private int _disposeSignaled ;
6060
6161 /// <summary>
6262 /// The browser
6363 /// </summary>
64- private IBrowser browser ;
64+ private IBrowser _browser ;
6565
6666 /// <summary>
6767 /// Initial browser load task complection source
6868 /// </summary>
69- private TaskCompletionSource < LoadUrlAsyncResponse > initialLoadTaskCompletionSource = new TaskCompletionSource < LoadUrlAsyncResponse > ( ) ;
69+ private TaskCompletionSource < LoadUrlAsyncResponse > _initialLoadTaskCompletionSource = new TaskCompletionSource < LoadUrlAsyncResponse > ( ) ;
7070
7171 /// <summary>
7272 /// Initial browser load action
7373 /// </summary>
74- private Action < bool ? , CefErrorCode ? > initialLoadAction ;
74+ private Action < bool ? , CefErrorCode ? > _initialLoadAction ;
7575
7676 /// <summary>
7777 /// Id
@@ -254,12 +254,12 @@ void IWebBrowserInternal.SetCanExecuteJavascriptOnMainFrame(long frameId, bool c
254254 //incorrectly overrides the value
255255 //https://github.com/cefsharp/CefSharp/issues/3021
256256
257- if ( frameId > canExecuteJavascriptInMainFrameId && ! canExecute )
257+ if ( frameId > _canExecuteJavascriptInMainFrameId && ! canExecute )
258258 {
259259 return ;
260260 }
261261
262- canExecuteJavascriptInMainFrameId = frameId ;
262+ _canExecuteJavascriptInMainFrameId = frameId ;
263263 CanExecuteJavascriptInMainFrame = canExecute ;
264264 }
265265
@@ -304,7 +304,7 @@ void IWebBrowserInternal.OnStatusMessage(StatusMessageEventArgs args)
304304 {
305305 StatusMessage ? . Invoke ( this , args ) ;
306306
307- outOfProcessServer . NotifyStatusMessage ( _id , args . Value ) ;
307+ _outofProcessHostRpc . NotifyStatusMessage ( _id , args . Value ) ;
308308 }
309309
310310 /// <summary>
@@ -315,7 +315,7 @@ void IWebBrowserInternal.OnLoadError(LoadErrorEventArgs args)
315315 {
316316 LoadError ? . Invoke ( this , args ) ;
317317
318- initialLoadAction ? . Invoke ( null , args . ErrorCode ) ;
318+ _initialLoadAction ? . Invoke ( null , args . ErrorCode ) ;
319319 }
320320
321321 /// <summary>
@@ -335,7 +335,7 @@ void IWebBrowserInternal.OnLoadError(LoadErrorEventArgs args)
335335 /// <value>The browser adapter.</value>
336336 IBrowserAdapter IWebBrowserInternal . BrowserAdapter
337337 {
338- get { return managedCefBrowserAdapter ; }
338+ get { return _managedCefBrowserAdapter ; }
339339 }
340340
341341 void IWebBrowserInternal . OnAfterBrowserCreated ( IBrowser browser )
@@ -345,25 +345,25 @@ void IWebBrowserInternal.OnAfterBrowserCreated(IBrowser browser)
345345 return ;
346346 }
347347
348- this . browser = browser ;
348+ this . _browser = browser ;
349349 BrowserCore = browser ;
350- initialLoadAction = InitialLoad ;
351- Interlocked . Exchange ( ref browserInitialized , 1 ) ;
350+ _initialLoadAction = InitialLoad ;
351+ Interlocked . Exchange ( ref _browserInitialized , 1 ) ;
352352
353353 var host = browser . GetHost ( ) ;
354- outOfProcessServer . NotifyBrowserCreated ( _id , browser . GetHost ( ) . GetWindowHandle ( ) ) ;
354+ _outofProcessHostRpc . NotifyBrowserCreated ( _id , browser . GetHost ( ) . GetWindowHandle ( ) ) ;
355355
356356 var observer = new CefSharpDevMessageObserver ( ) ;
357357 observer . OnDevToolsAgentDetached ( ( b ) =>
358358 {
359- outOfProcessServer . NotifyDevToolsAgentDetached ( _id ) ;
359+ _outofProcessHostRpc . NotifyDevToolsAgentDetached ( _id ) ;
360360 } ) ;
361361 observer . OnDevToolsMessage ( ( b , m ) =>
362362 {
363363 using var reader = new StreamReader ( m ) ;
364364 var msg = reader . ReadToEnd ( ) ;
365365
366- outOfProcessServer . NotifyDevToolsMessage ( _id , msg ) ;
366+ _outofProcessHostRpc . NotifyDevToolsMessage ( _id , msg ) ;
367367 } ) ;
368368
369369 _devtoolsMessageObserver = observer ;
@@ -384,7 +384,7 @@ void IWebBrowserInternal.OnAfterBrowserCreated(IBrowser browser)
384384 {
385385 ( ( IDisposable ) devToolsClient ) . Dispose ( ) ;
386386
387- outOfProcessServer . NotifyDevToolsReady ( _id ) ;
387+ _outofProcessHostRpc . NotifyDevToolsReady ( _id ) ;
388388
389389 } , TaskScheduler . Default ) ;
390390 }
@@ -399,7 +399,7 @@ void IWebBrowserInternal.SetLoadingStateChange(LoadingStateChangedEventArgs args
399399
400400 LoadingStateChanged ? . Invoke ( this , args ) ;
401401
402- initialLoadAction ? . Invoke ( args . IsLoading , null ) ;
402+ _initialLoadAction ? . Invoke ( args . IsLoading , null ) ;
403403 }
404404
405405 /// <inheritdoc/>
@@ -425,13 +425,13 @@ public Task<WaitForNavigationAsyncResponse> WaitForNavigationAsync(TimeSpan? tim
425425 /// <inheritdoc/>
426426 public Task < LoadUrlAsyncResponse > WaitForInitialLoadAsync ( )
427427 {
428- return initialLoadTaskCompletionSource . Task ;
428+ return _initialLoadTaskCompletionSource . Task ;
429429 }
430430
431431 /// <inheritdoc/>
432432 public bool TryGetBrowserCoreById ( int browserId , out IBrowser browser )
433433 {
434- var browserAdapter = managedCefBrowserAdapter ;
434+ var browserAdapter = _managedCefBrowserAdapter ;
435435
436436 if ( IsDisposed || browserAdapter == null || browserAdapter . IsDisposed )
437437 {
@@ -451,7 +451,7 @@ public bool TryGetBrowserCoreById(int browserId, out IBrowser browser)
451451 ThrowExceptionIfDisposed ( ) ;
452452 ThrowExceptionIfBrowserNotInitialized ( ) ;
453453
454- using ( var devToolsClient = browser . GetDevToolsClient ( ) )
454+ using ( var devToolsClient = _browser . GetDevToolsClient ( ) )
455455 {
456456 //Get the content size
457457 var layoutMetricsResponse = await devToolsClient . Page . GetLayoutMetricsAsync ( ) . ConfigureAwait ( continueOnCapturedContext : false ) ;
@@ -464,9 +464,9 @@ private void InitialLoad(bool? isLoading, CefErrorCode? errorCode)
464464 {
465465 if ( IsDisposed )
466466 {
467- initialLoadAction = null ;
467+ _initialLoadAction = null ;
468468
469- initialLoadTaskCompletionSource . TrySetCanceled ( ) ;
469+ _initialLoadTaskCompletionSource . TrySetCanceled ( ) ;
470470
471471 return ;
472472 }
@@ -478,9 +478,9 @@ private void InitialLoad(bool? isLoading, CefErrorCode? errorCode)
478478 return ;
479479 }
480480
481- initialLoadAction = null ;
481+ _initialLoadAction = null ;
482482
483- var host = browser ? . GetHost ( ) ;
483+ var host = _browser ? . GetHost ( ) ;
484484
485485 var navEntry = host ? . GetVisibleNavigationEntry ( ) ;
486486
@@ -493,7 +493,7 @@ private void InitialLoad(bool? isLoading, CefErrorCode? errorCode)
493493 statusCode = - 1 ;
494494 }
495495
496- initialLoadTaskCompletionSource . TrySetResultAsync ( new LoadUrlAsyncResponse ( CefErrorCode . None , statusCode ) ) ;
496+ _initialLoadTaskCompletionSource . TrySetResultAsync ( new LoadUrlAsyncResponse ( CefErrorCode . None , statusCode ) ) ;
497497 }
498498 else if ( errorCode . HasValue )
499499 {
@@ -504,9 +504,9 @@ private void InitialLoad(bool? isLoading, CefErrorCode? errorCode)
504504 return ;
505505 }
506506
507- initialLoadAction = null ;
507+ _initialLoadAction = null ;
508508
509- initialLoadTaskCompletionSource . TrySetResultAsync ( new LoadUrlAsyncResponse ( errorCode . Value , - 1 ) ) ;
509+ _initialLoadTaskCompletionSource . TrySetResultAsync ( new LoadUrlAsyncResponse ( errorCode . Value , - 1 ) ) ;
510510 }
511511 }
512512
@@ -544,7 +544,7 @@ private bool InternalIsBrowserInitialized()
544544 {
545545 // Use CompareExchange to read the current value - if disposeCount is 1, we set it to 1, effectively a no-op
546546 // Volatile.Read would likely use a memory barrier which I believe is unnecessary in this scenario
547- return Interlocked . CompareExchange ( ref browserInitialized , 0 , 0 ) == 1 ;
547+ return Interlocked . CompareExchange ( ref _browserInitialized , 0 , 0 ) == 1 ;
548548 }
549549
550550 /// <summary>
@@ -579,7 +579,7 @@ public bool IsDisposed
579579 {
580580 get
581581 {
582- return Interlocked . CompareExchange ( ref disposeSignaled , 1 , 1 ) == 1 ;
582+ return Interlocked . CompareExchange ( ref _disposeSignaled , 1 , 1 ) == 1 ;
583583 }
584584 }
585585
@@ -675,12 +675,12 @@ public OutOfProcessChromiumWebBrowser(IOutOfProcessHostRpc outOfProcessServer, i
675675 {
676676 _id = id ;
677677 RequestContext = requestContext ;
678- this . outOfProcessServer = outOfProcessServer ;
678+ this . _outofProcessHostRpc = outOfProcessServer ;
679679
680680 Cef . AddDisposable ( this ) ;
681681 Address = address ;
682682
683- managedCefBrowserAdapter = ManagedCefBrowserAdapter . Create ( this , false ) ;
683+ _managedCefBrowserAdapter = ManagedCefBrowserAdapter . Create ( this , false ) ;
684684 }
685685
686686 /// <summary>
@@ -708,7 +708,7 @@ protected virtual void Dispose(bool disposing)
708708 {
709709 // Attempt to move the disposeSignaled state from 0 to 1. If successful, we can be assured that
710710 // this thread is the first thread to do so, and can safely dispose of the object.
711- if ( Interlocked . CompareExchange ( ref disposeSignaled , 1 , 0 ) != 0 )
711+ if ( Interlocked . CompareExchange ( ref _disposeSignaled , 1 , 0 ) != 0 )
712712 {
713713 return ;
714714 }
@@ -721,7 +721,7 @@ protected virtual void Dispose(bool disposing)
721721 _devtoolsMessageObserver = null ;
722722
723723 CanExecuteJavascriptInMainFrame = false ;
724- Interlocked . Exchange ( ref browserInitialized , 0 ) ;
724+ Interlocked . Exchange ( ref _browserInitialized , 0 ) ;
725725
726726 // Don't reference event listeners any longer:
727727 AddressChanged = null ;
@@ -742,11 +742,11 @@ protected virtual void Dispose(bool disposing)
742742
743743 FocusHandler = new NoFocusHandler ( ) ;
744744
745- browser = null ;
745+ _browser = null ;
746746 BrowserCore = null ;
747747
748- managedCefBrowserAdapter ? . Dispose ( ) ;
749- managedCefBrowserAdapter = null ;
748+ _managedCefBrowserAdapter ? . Dispose ( ) ;
749+ _managedCefBrowserAdapter = null ;
750750
751751 // LifeSpanHandler is set to null after managedCefBrowserAdapter.Dispose so ILifeSpanHandler.DoClose
752752 // is called.
@@ -764,12 +764,12 @@ protected virtual void Dispose(bool disposing)
764764 /// <exception cref="System.Exception">An instance of the underlying browser has already been created, this method can only be called once.</exception>
765765 public void CreateBrowser ( IWindowInfo windowInfo = null , IBrowserSettings browserSettings = null )
766766 {
767- if ( browserCreated )
767+ if ( _browserCreated )
768768 {
769769 throw new Exception ( "An instance of the underlying browser has already been created, this method can only be called once." ) ;
770770 }
771771
772- browserCreated = true ;
772+ _browserCreated = true ;
773773
774774 if ( browserSettings == null )
775775 {
@@ -792,7 +792,7 @@ public void CreateBrowser(IWindowInfo windowInfo = null, IBrowserSettings browse
792792 return ;
793793 }
794794
795- managedCefBrowserAdapter . CreateBrowser ( windowInfo , browserSettings , RequestContext , Address ) ;
795+ _managedCefBrowserAdapter . CreateBrowser ( windowInfo , browserSettings , RequestContext , Address ) ;
796796
797797 //Dispose of BrowserSettings if we created it, if user created then they're responsible
798798 if ( browserSettings . AutoDispose )
@@ -834,7 +834,7 @@ public void Load(string url)
834834 /// </summary>
835835 public IJavascriptObjectRepository JavascriptObjectRepository
836836 {
837- get { return managedCefBrowserAdapter ? . JavascriptObjectRepository ; }
837+ get { return _managedCefBrowserAdapter ? . JavascriptObjectRepository ; }
838838 }
839839
840840 /// <summary>
@@ -861,7 +861,7 @@ public IBrowser GetBrowser()
861861 ThrowExceptionIfDisposed ( ) ;
862862 ThrowExceptionIfBrowserNotInitialized ( ) ;
863863
864- return browser ;
864+ return _browser ;
865865 }
866866
867867 /// <summary>
@@ -874,7 +874,7 @@ void IWebBrowserInternal.SetAddress(AddressChangedEventArgs args)
874874
875875 AddressChanged ? . Invoke ( this , args ) ;
876876
877- outOfProcessServer . NotifyAddressChanged ( _id , args . Address ) ;
877+ _outofProcessHostRpc . NotifyAddressChanged ( _id , args . Address ) ;
878878 }
879879
880880 /// <summary>
@@ -887,7 +887,7 @@ partial void SetLoadingStateChange(LoadingStateChangedEventArgs args)
887887 CanGoForward = args . CanGoForward ;
888888 IsLoading = args . IsLoading ;
889889
890- outOfProcessServer . NotifyLoadingStateChange ( _id , args . CanGoBack , args . CanGoForward , args . IsLoading ) ;
890+ _outofProcessHostRpc . NotifyLoadingStateChange ( _id , args . CanGoBack , args . CanGoForward , args . IsLoading ) ;
891891 }
892892
893893 /// <summary>
@@ -898,7 +898,7 @@ void IWebBrowserInternal.SetTitle(TitleChangedEventArgs args)
898898 {
899899 TitleChanged ? . Invoke ( this , args ) ;
900900
901- outOfProcessServer . NotifyTitleChanged ( _id , args . Title ) ;
901+ _outofProcessHostRpc . NotifyTitleChanged ( _id , args . Title ) ;
902902 }
903903
904904 /// <summary>
0 commit comments