Files
cefsharp/CefSharp.BrowserSubprocess.Core/Async/JavascriptAsyncMethodHandler.h
T
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00

46 lines
1.7 KiB
C++

// Copyright © 2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "include/cef_v8.h"
#include "JavascriptCallbackRegistry.h"
#include "JavascriptAsyncMethodCallback.h"
namespace CefSharp
{
namespace Internals
{
namespace Async
{
private class JavascriptAsyncMethodHandler : public virtual CefV8Handler
{
private:
gcroot<JavascriptCallbackRegistry^> _callbackRegistry;
gcroot<Func<JavascriptAsyncMethodCallback^, int64>^> _methodCallbackSave;
int64 _objectId;
public:
JavascriptAsyncMethodHandler(int64 objectId, JavascriptCallbackRegistry^ callbackRegistry, Func<JavascriptAsyncMethodCallback^, int64>^ methodCallbackSave)
:_callbackRegistry(callbackRegistry), _objectId(objectId), _methodCallbackSave(methodCallbackSave)
{
}
virtual bool Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception);
~JavascriptAsyncMethodHandler()
{
// The callback registry is a shared instance among all method handlers (async & sync).
// It's lifecycle is managed in the JavascriptRootObjectWrapper.
_callbackRegistry = nullptr;
_methodCallbackSave = nullptr;
}
IMPLEMENT_REFCOUNTING(JavascriptAsyncMethodHandler)
};
}
}
}