mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
async method bindings added
This commit is contained in:
committed by
cefsharp-ms cefsharp-github@morganstanley.com
parent
0e073bcd0a
commit
4ec6d1ca6e
@@ -0,0 +1,40 @@
|
||||
// Copyright © 2010-2015 The CefSharp Project. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "JavascriptAsyncMethodHandler.h"
|
||||
#include "../CefSharp.Core/Internals/Messaging/Messages.h"
|
||||
#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
|
||||
#include "Serialization/V8Serialization.h"
|
||||
#include "CefBrowserWrapper.h"
|
||||
|
||||
using namespace CefSharp::Internals::Messaging;
|
||||
using namespace CefSharp::Internals::Serialization;
|
||||
|
||||
namespace CefSharp
|
||||
{
|
||||
namespace Internals
|
||||
{
|
||||
namespace Async
|
||||
{
|
||||
bool JavascriptAsyncMethodHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception)
|
||||
{
|
||||
auto request = CefProcessMessage::Create(kJavascriptMethodCallRequest);
|
||||
auto argList = request->GetArgumentList();
|
||||
auto params = CefListValue::Create();
|
||||
for (auto i = 0; i < arguments.size(); i++)
|
||||
{
|
||||
SerializeV8Object(arguments[i], params, i, _callbackRegistry);
|
||||
}
|
||||
|
||||
SetInt64(_objectId, argList, 0);
|
||||
argList->SetString(1, StringUtils::ToNative(_method->JavascriptName));
|
||||
argList->SetList(2, params);
|
||||
|
||||
_browser->SendProcessMessage(CefProcessId::PID_BROWSER, request);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user