libcef: Update due to underlying chromium changes.

- WebKit API changes.
- Delay OnClose actions in WebSocketStreamHandleBridgeImpl.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@63 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2009-11-03 01:39:16 +00:00
parent cd500a98a9
commit 7e7592b298
7 changed files with 54 additions and 30 deletions

View File

@ -45,3 +45,4 @@ Date | CEF Revision | Chromium Revision
2009-10-18 | /trunk@58 | /trunk@29378
2009-10-21 | /trunk@60 | /trunk@29687
2009-10-25 | /trunk@61 | /trunk@30028
2009-11-02 | /trunk@63 | /trunk@30778

View File

@ -146,10 +146,10 @@
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
'../third_party/zlib/zlib.gyp:zlib',
'../webkit/api/WebKit.gyp:webkit',
'../webkit/webkit.gyp:appcache',
'../webkit/webkit.gyp:database',
'../webkit/webkit.gyp:glue',
'../webkit/webkit.gyp:webkit',
'../webkit/webkit.gyp:webkit_resources',
'../webkit/webkit.gyp:webkit_strings',
'../webkit/default_plugin/default_plugin.gyp:default_plugin',
@ -308,10 +308,10 @@
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
'../third_party/zlib/zlib.gyp:zlib',
'../webkit/api/WebKit.gyp:webkit',
'../webkit/webkit.gyp:appcache',
'../webkit/webkit.gyp:database',
'../webkit/webkit.gyp:glue',
'../webkit/webkit.gyp:webkit',
'../webkit/webkit.gyp:webkit_resources',
'../webkit/webkit.gyp:webkit_strings',
'../webkit/default_plugin/default_plugin.gyp:default_plugin',

View File

@ -59,7 +59,7 @@ class WebSocketStreamHandleBridgeImpl
void DoOnConnected(int max_amount_send_allowed);
void DoOnSentData(int amount_sent);
void DoOnReceivedData(std::vector<char>* data);
void DoOnClose(webkit_glue::WebSocketStreamHandleDelegate* delegate);
void DoOnClose();
int socket_id_;
MessageLoop* message_loop_;
@ -67,6 +67,8 @@ class WebSocketStreamHandleBridgeImpl
webkit_glue::WebSocketStreamHandleDelegate* delegate_;
scoped_refptr<net::SocketStream> socket_;
// Number of pending tasks to handle net::SocketStream::Delegate methods.
int num_pending_tasks_;
DISALLOW_COPY_AND_ASSIGN(WebSocketStreamHandleBridgeImpl);
};
@ -77,15 +79,16 @@ WebSocketStreamHandleBridgeImpl::WebSocketStreamHandleBridgeImpl(
: socket_id_(kNoSocketId),
message_loop_(MessageLoop::current()),
handle_(handle),
delegate_(delegate) {
delegate_(delegate),
num_pending_tasks_(0) {
}
WebSocketStreamHandleBridgeImpl::~WebSocketStreamHandleBridgeImpl() {
CHECK(socket_id_ == kNoSocketId);
DCHECK_EQ(socket_id_, kNoSocketId);
}
void WebSocketStreamHandleBridgeImpl::Connect(const GURL& url) {
CHECK(g_io_thread);
DCHECK(g_io_thread);
AddRef(); // Released in DoOnClose().
g_io_thread->PostTask(
FROM_HERE,
@ -97,7 +100,7 @@ void WebSocketStreamHandleBridgeImpl::Connect(const GURL& url) {
bool WebSocketStreamHandleBridgeImpl::Send(
const std::vector<char>& data) {
CHECK(g_io_thread);
DCHECK(g_io_thread);
g_io_thread->PostTask(
FROM_HERE,
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoSend,
@ -106,7 +109,7 @@ bool WebSocketStreamHandleBridgeImpl::Send(
}
void WebSocketStreamHandleBridgeImpl::Close() {
CHECK(g_io_thread);
DCHECK(g_io_thread);
g_io_thread->PostTask(
FROM_HERE,
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoClose));
@ -114,6 +117,7 @@ void WebSocketStreamHandleBridgeImpl::Close() {
void WebSocketStreamHandleBridgeImpl::OnConnected(
net::SocketStream* socket, int max_pending_send_allowed) {
++num_pending_tasks_;
message_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnConnected,
@ -122,6 +126,7 @@ void WebSocketStreamHandleBridgeImpl::OnConnected(
void WebSocketStreamHandleBridgeImpl::OnSentData(
net::SocketStream* socket, int amount_sent) {
++num_pending_tasks_;
message_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnSentData,
@ -130,6 +135,7 @@ void WebSocketStreamHandleBridgeImpl::OnSentData(
void WebSocketStreamHandleBridgeImpl::OnReceivedData(
net::SocketStream* socket, const char* data, int len) {
++num_pending_tasks_;
message_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this,
@ -138,25 +144,24 @@ void WebSocketStreamHandleBridgeImpl::OnReceivedData(
}
void WebSocketStreamHandleBridgeImpl::OnClose(net::SocketStream* socket) {
webkit_glue::WebSocketStreamHandleDelegate* delegate = delegate_;
delegate_ = NULL;
socket_ = 0;
++num_pending_tasks_;
// Release socket_ on IO thread.
socket_ = NULL;
socket_id_ = kNoSocketId;
message_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnClose,
delegate));
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnClose));
}
void WebSocketStreamHandleBridgeImpl::DoConnect(const GURL& url) {
CHECK(MessageLoop::current() == g_io_thread);
DCHECK(MessageLoop::current() == g_io_thread);
socket_ = new net::SocketStream(url, this);
socket_->set_context(g_request_context);
socket_->Connect();
}
void WebSocketStreamHandleBridgeImpl::DoSend(std::vector<char>* data) {
CHECK(MessageLoop::current() == g_io_thread);
DCHECK(MessageLoop::current() == g_io_thread);
scoped_ptr<std::vector<char> > scoped_data(data);
if (!socket_)
return;
@ -165,7 +170,7 @@ void WebSocketStreamHandleBridgeImpl::DoSend(std::vector<char>* data) {
}
void WebSocketStreamHandleBridgeImpl::DoClose() {
CHECK(MessageLoop::current() == g_io_thread);
DCHECK(MessageLoop::current() == g_io_thread);
if (!socket_)
return;
socket_->Close();
@ -173,29 +178,37 @@ void WebSocketStreamHandleBridgeImpl::DoClose() {
void WebSocketStreamHandleBridgeImpl::DoOnConnected(
int max_pending_send_allowed) {
CHECK(MessageLoop::current() == message_loop_);
DCHECK(MessageLoop::current() == message_loop_);
--num_pending_tasks_;
if (delegate_)
delegate_->DidOpenStream(handle_, max_pending_send_allowed);
}
void WebSocketStreamHandleBridgeImpl::DoOnSentData(int amount_sent) {
CHECK(MessageLoop::current() == message_loop_);
DCHECK(MessageLoop::current() == message_loop_);
--num_pending_tasks_;
if (delegate_)
delegate_->DidSendData(handle_, amount_sent);
}
void WebSocketStreamHandleBridgeImpl::DoOnReceivedData(
std::vector<char>* data) {
CHECK(MessageLoop::current() == message_loop_);
DCHECK(MessageLoop::current() == message_loop_);
--num_pending_tasks_;
scoped_ptr<std::vector<char> > scoped_data(data);
if (delegate_)
delegate_->DidReceiveData(handle_, &(data->at(0)), data->size());
}
void WebSocketStreamHandleBridgeImpl::DoOnClose(
webkit_glue::WebSocketStreamHandleDelegate* delegate) {
CHECK(MessageLoop::current() == message_loop_);
CHECK(!socket_);
void WebSocketStreamHandleBridgeImpl::DoOnClose() {
DCHECK(MessageLoop::current() == message_loop_);
--num_pending_tasks_;
// Don't handle OnClose if there are pending tasks.
DCHECK_EQ(num_pending_tasks_, 0);
DCHECK(!socket_);
DCHECK_EQ(socket_id_, kNoSocketId);
webkit_glue::WebSocketStreamHandleDelegate* delegate = delegate_;
delegate_ = NULL;
if (delegate)
delegate->DidClose(handle_);
Release();

View File

@ -9,7 +9,7 @@
MSVC_PUSH_WARNING_LEVEL(0);
#include "Cache.h"
#include "TextEncoding.h"
#include "webkit/glue/webframe_impl.h"
#include "webkit/api/src/WebFrameImpl.h"
MSVC_POP_WARNING();
#include "browser_webkit_glue.h"
@ -29,6 +29,8 @@ MSVC_POP_WARNING();
// Generated by GRIT
#include "grit/webkit_resources.h"
using WebKit::WebFrameImpl;
namespace webkit_glue {
bool IsMediaPlayerAvailable() {

View File

@ -18,6 +18,7 @@
#include "webkit/extensions/v8/interval_extension.h"
#include "webkit/api/public/WebCString.h"
#include "webkit/api/public/WebData.h"
#include "webkit/api/public/WebRuntimeFeatures.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebScriptController.h"
#include "webkit/api/public/WebSecurityPolicy.h"
@ -50,14 +51,13 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
extensions_v8::GearsExtension::Get());
WebKit::WebScriptController::registerExtension(
extensions_v8::IntervalExtension::Get());
WebKit::enableWebSockets();
WebKit::WebRuntimeFeatures::enableSockets(true);
// Load libraries for media and enable the media player.
FilePath module_path;
if (PathService::Get(base::DIR_MODULE, &module_path) &&
media::InitializeMediaLibrary(module_path)) {
WebKit::enableMediaPlayer();
}
WebKit::WebRuntimeFeatures::enableMediaPlayer(
PathService::Get(base::DIR_MODULE, &module_path) &&
media::InitializeMediaLibrary(module_path));
// Construct and initialize an appcache system for this scope.
// A new empty temp directory is created to house any cached
@ -200,7 +200,11 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
return BrowserAppCacheSystem::CreateApplicationCacheHost(client);
}
private:
virtual WebKit::WebSharedWorkerRepository* sharedWorkerRepository() {
return NULL;
}
private:
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
webkit_glue::WebClipboardImpl clipboard_;
ScopedTempDir appcache_dir_;

View File

@ -341,6 +341,9 @@ void BrowserWebViewDelegate::setStatusText(const WebString& text) {
void BrowserWebViewDelegate::setMouseOverURL(const WebURL& url) {
}
void BrowserWebViewDelegate::setKeyboardFocusURL(const WebKit::WebURL& url) {
}
void BrowserWebViewDelegate::setToolTipText(
const WebString& text, WebTextDirection hint) {
}

View File

@ -103,6 +103,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
virtual void setStatusText(const WebKit::WebString& text);
virtual void setMouseOverURL(const WebKit::WebURL& url);
virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
virtual void setToolTipText(
const WebKit::WebString& text, WebKit::WebTextDirection hint);
virtual void startDragging(