コード例 #1
0
 public PPResource(PPResource resource) : this(resource.ppresource)
 {
     if (!resource.IsEmpty)
     {
         PPBCore.AddRefResource(this);
     }
 }
コード例 #2
0
 void Dispose(bool disposing)
 {
     if (!IsEmpty)
     {
         if (disposing)
         {
             // de-reference the managed resource.
             PPBCore.ReleaseResource(this);
         }
         ppresource = 0; // set ourselves to empty
     }
 }
コード例 #3
0
ファイル: runtime.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// Method that will release all the PPResource's that have been placed on the queue to be released.
 /// </summary>
 /// <param name="result"></param>
 void ReleasePump(PPError result)
 {
     if (!resourceReleaseQueue.IsEmpty)
     {
         object resourceToBeReleased;
         while (resourceReleaseQueue.TryDequeue(out resourceToBeReleased))
         {
             if (resourceToBeReleased is PPResource)
             {
                 PPBCore.ReleaseResource((PPResource)resourceToBeReleased);
             }
             else if (resourceToBeReleased is PPVar)
             {
                 PPBVar.Release((PPVar)resourceToBeReleased);
             }
         }
     }
     PPBCore.CallOnMainThread(releaseLoopTime, new CompletionCallback(ReleasePump), releaseLoopTime);
 }
コード例 #4
0
ファイル: Core.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// CallOnMainThread() schedules work to be executed on the main pepper
 /// thread after the specified delay. The delay may be 0 to specify a call
 /// back as soon as possible.
 ///
 /// The |result| parameter will just be passed as the second argument to the
 /// callback. Many applications won't need this, but it allows a module to
 /// emulate calls of some callbacks which do use this value.
 ///
 /// <strong>Note:</strong> CallOnMainThread(), even when used from the main
 /// thread with a delay of 0 milliseconds, will never directly invoke the
 /// callback.  Even in this case, the callback will be scheduled
 /// asynchronously.
 ///
 /// <strong>Note:</strong> If the browser is shutting down or if the module
 /// has no instances, then the callback function may not be called.
 /// </summary>
 /// <typeparam name="T">User data type</typeparam>
 /// <param name="action">An <code>Action<PPError, T></code> callback function
 /// that the browser will call after the specified delay.
 /// </param>
 /// <param name="delay_in_milliseconds">An int delay in milliseconds.  Default 0</param>
 /// <param name="result">An int that the browser will pass to the given
 /// <code>Action<PPError></PPError></code>.  Default 0
 /// </param>
 public static void CallOnMainThread <T>(Action <PPError, T> action,
                                         T userData1,
                                         int delay_in_milliseconds = 0,
                                         int result = 0)
 => PPBCore.CallOnMainThread(delay_in_milliseconds, new CompletionCallback <T>(new CompletionCallbackFunc <T>(action), userData1), result);
コード例 #5
0
ファイル: Core.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// CallOnMainThread() schedules work to be executed on the main pepper
 /// thread after the specified delay. The delay may be 0 to specify a call
 /// back as soon as possible.
 ///
 /// The |result| parameter will just be passed as the second argument to the
 /// callback. Many applications won't need this, but it allows a module to
 /// emulate calls of some callbacks which do use this value.
 ///
 /// <strong>Note:</strong> CallOnMainThread(), even when used from the main
 /// thread with a delay of 0 milliseconds, will never directly invoke the
 /// callback.  Even in this case, the callback will be scheduled
 /// asynchronously.
 ///
 /// <strong>Note:</strong> If the browser is shutting down or if the module
 /// has no instances, then the callback function may not be called.
 ///
 /// </summary>
 /// <param name="action">An <code>Action<PPError></code> callback function
 /// that the browser will call after the specified delay.
 /// </param>
 /// <param name="delay_in_milliseconds">An int delay in milliseconds.  Default 0</param>
 /// <param name="result">An int that the browser will pass to the given
 /// <code>Action<PPError></PPError></code>.  Default 0</param>
 public static void CallOnMainThread(Action <PPError> action,
                                     int delay_in_milliseconds = 0,
                                     int result = 0)
 => PPBCore.CallOnMainThread(delay_in_milliseconds, new CompletionCallback(new CompletionCallbackFunc(action)), result);
コード例 #6
0
ファイル: Core.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// ReleaseResource() decrements the reference count for the provided
 /// <code>resource</code>. The resource will be deallocated if the
 /// reference count reaches zero.
 /// </summary>
 /// <param name="resource">A <code>Resource</code> corresponding to a
 /// resource.</param>
 public static void ReleaseResource(Resource resource) => PPBCore.ReleaseResource(resource);
コード例 #7
0
ファイル: Core.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// AddRefResource() increments the reference count for the provided
 /// <code>resource</code>.
 /// </summary>
 /// <param name="resource">A <code>Resource</code> corresponding to a
 /// resource.</param>
 public static void AddRefResource(Resource resource) => PPBCore.AddRefResource(resource);
コード例 #8
0
ファイル: runtime.cs プロジェクト: vzolotov/WebSharp
 /// <summary>
 /// The method is called to start a call back process on the Browsers main thread
 /// </summary>
 void StartReleasePump()
 {
     PPBCore.CallOnMainThread(releaseLoopTime, new CompletionCallback(ReleasePump), releaseLoopTime);
 }
コード例 #9
0
ファイル: InputEvent.cs プロジェクト: vzolotov/WebSharp
 public MouseInputEvent(InputEvent inputEvent)
 {
     PPBCore.AddRefResource(inputEvent.Handle);
     handle = inputEvent.handle;
 }
コード例 #10
0
ファイル: InputEvent.cs プロジェクト: vzolotov/WebSharp
 public KeyboardInputEvent(InputEvent inputEvent)
 {
     PPBCore.AddRefResource(inputEvent.Handle);
     handle = inputEvent.handle;
 }