mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
Add some descriptive comments about what some of the subprocess classes do.
This commit is contained in:
@@ -15,6 +15,7 @@ using namespace System::Collections::Generic;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
// This class is the native subprocess level CEF object wrapper.
|
||||
private class CefAppUnmanagedWrapper : CefApp, CefRenderProcessHandler
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -15,6 +15,7 @@ using namespace System::Collections::Generic;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
// Wrap CefAppUnmangedWrapper in a nice managed wrapper
|
||||
public ref class CefAppWrapper abstract : public DisposableResource
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -20,7 +20,8 @@ using namespace System::Threading::Tasks;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
// "Master class" for wrapping everything that the CefSubprocess needs.
|
||||
// "Master class" for wrapping everything that the Cef Subprocess needs
|
||||
// for ONE CefBrowser.
|
||||
public ref class CefBrowserWrapper : DisposableResource
|
||||
{
|
||||
|
||||
@@ -35,13 +36,20 @@ namespace CefSharp
|
||||
|
||||
property int BrowserId;
|
||||
property bool IsPopup;
|
||||
|
||||
// This allows us to create the WCF proxies back to our parent process.
|
||||
property DuplexChannelFactory<IBrowserProcess^>^ ChannelFactory;
|
||||
|
||||
// The serialized registered object data waiting to be used.
|
||||
property JavascriptRootObject^ JavascriptRootObject;
|
||||
|
||||
property JavascriptRootObjectWrapper^ JavascriptRootObjectWrapper
|
||||
{
|
||||
CefSharp::JavascriptRootObjectWrapper^ get();
|
||||
void set(CefSharp::JavascriptRootObjectWrapper^ value);
|
||||
};
|
||||
|
||||
// The WCF proxy to the parent process.
|
||||
property IBrowserProcess^ BrowserProcess;
|
||||
|
||||
JavascriptResponse^ EvaluateScriptInContext(CefRefPtr<CefV8Context> context, CefString script);
|
||||
|
||||
@@ -16,6 +16,10 @@ using namespace CefSharp::Internals;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
// This wraps the transmitted registered objects
|
||||
// by binding the meta-data to V8 JavaScript objects
|
||||
// and installing callbacks for changes to those
|
||||
// objects.
|
||||
public ref class JavascriptRootObjectWrapper
|
||||
{
|
||||
private:
|
||||
@@ -24,7 +28,12 @@ namespace CefSharp
|
||||
IBrowserProcess^ _browserProcess;
|
||||
|
||||
internal:
|
||||
// TODO: Is this member variable necessary?
|
||||
// We only use it to call a static method on CefV8Value atm.
|
||||
MCefRefPtr<CefV8Value> V8Value;
|
||||
|
||||
// The entire set of possible JavaScript functions to
|
||||
// call directly into.
|
||||
JavascriptCallbackRegistry^ CallbackRegistry;
|
||||
|
||||
public:
|
||||
|
||||
@@ -7,6 +7,12 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace CefSharp.Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// This maps the registered objects in the browser process
|
||||
/// to the reflection data necessary to update the objects,
|
||||
/// and mapping information to how the object/method/proprerty
|
||||
/// will be exposed to JavaScript.
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public class JavascriptObject //: DynamicObject maybe later
|
||||
{
|
||||
|
||||
@@ -9,12 +9,35 @@ using System.Reflection;
|
||||
|
||||
namespace CefSharp.Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// This class manages the registration of objects in the browser
|
||||
/// process to be exposed to JavaScript in the renderer process.
|
||||
/// Registration performs method, parameter, property type analysis
|
||||
/// of the registered objects into meta-data tied to reflection data
|
||||
/// for later use.
|
||||
///
|
||||
/// This class also is the adaptation layer between the BrowserProcessService
|
||||
/// and the registered objects. This means when the renderer wants to call an
|
||||
/// exposed method, get a property of an object, or
|
||||
/// set a property of an object in the browser process, that this
|
||||
/// class does deals with the previously created meta-data and invokes the correct
|
||||
/// behavior via reflection APIs.
|
||||
///
|
||||
/// All of the registered objects are tracked via meta-data for the objects
|
||||
/// expressed starting with the JavaScriptObject type.
|
||||
/// </summary>
|
||||
public class JavascriptObjectRepository : DisposableResource
|
||||
{
|
||||
private static long lastId;
|
||||
private static readonly object Lock = new object();
|
||||
|
||||
// A hash from assigned object ids to the objects,
|
||||
// this is done to speed up finding the object in O(1) time
|
||||
// instead of traversing the JavaScriptRootObject tree.
|
||||
private readonly Dictionary<long, JavascriptObject> objects = new Dictionary<long, JavascriptObject>();
|
||||
|
||||
// This is the root of the objects that get serialized to the child
|
||||
// process.
|
||||
public JavascriptRootObject RootObject { get; private set; }
|
||||
|
||||
public JavascriptObjectRepository()
|
||||
|
||||
Reference in New Issue
Block a user