Skip to content

Commit

Permalink
Merge pull request #100 from atom/chrome42
Browse files Browse the repository at this point in the history
Upgrade to Chrome 42
  • Loading branch information
zcbenz committed Apr 22, 2015
2 parents 34cd035 + 685435a commit dadcb46
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 33 deletions.
4 changes: 4 additions & 0 deletions brightray.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'<(libchromiumcontent_src_dir)',
'<(libchromiumcontent_src_dir)/skia/config',
'<(libchromiumcontent_src_dir)/third_party/skia/include/core',
'<(libchromiumcontent_src_dir)/third_party/mojo/src',
'<(libchromiumcontent_src_dir)/third_party/WebKit',
'<(libchromiumcontent_dir)/gen',
],
Expand All @@ -26,6 +27,7 @@
'<(libchromiumcontent_src_dir)/skia/config',
'<(libchromiumcontent_src_dir)/third_party/skia/include/core',
'<(libchromiumcontent_src_dir)/third_party/icu/source/common',
'<(libchromiumcontent_src_dir)/third_party/mojo/src',
'<(libchromiumcontent_src_dir)/third_party/WebKit',
'<(libchromiumcontent_dir)/gen',
],
Expand Down Expand Up @@ -137,6 +139,8 @@
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
# content_browser.gypi:
'$(SDKROOT)/usr/lib/libbsm.dylib',
# bluetooth.gyp:
'$(SDKROOT)/System/Library/Frameworks/IOBluetooth.framework',
],
},
}],
Expand Down
2 changes: 2 additions & 0 deletions brightray.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
'defines': [
# We are using Release version libchromiumcontent:
'NDEBUG',
# Needed by gin:
'V8_USE_EXTERNAL_STARTUP_DATA',
# From skia_for_chromium_defines.gypi:
'SK_SUPPORT_LEGACY_GETTOPDEVICE',
'SK_SUPPORT_LEGACY_BITMAP_CONFIG',
Expand Down
36 changes: 35 additions & 1 deletion browser/browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

#include "base/base_paths.h"
#include "base/path_service.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/url_constants.h"
#include "gin/public/isolate_holder.h"

namespace brightray {

Expand All @@ -27,9 +29,14 @@ BrowserClient* BrowserClient::Get() {
}

BrowserClient::BrowserClient()
: browser_main_parts_() {
: browser_main_parts_(nullptr) {
DCHECK(!g_browser_client);
g_browser_client = this;

#if defined(OS_POSIX) && !defined(OS_MACOSX)
v8_natives_fd_.reset(-1);
v8_snapshot_fd_.reset(-1);
#endif // OS_POSIX && !OS_MACOSX
}

BrowserClient::~BrowserClient() {
Expand Down Expand Up @@ -86,4 +93,31 @@ content::DevToolsManagerDelegate* BrowserClient::GetDevToolsManagerDelegate() {
return new DevToolsManagerDelegate;
}

#if defined(OS_POSIX) && !defined(OS_MACOSX)
void BrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
content::FileDescriptorInfo* mappings) {
if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) {
base::FilePath v8_data_path;
PathService::Get(gin::IsolateHolder::kV8SnapshotBasePathKey, &v8_data_path);
DCHECK(!v8_data_path.empty());

int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
base::FilePath v8_natives_data_path =
v8_data_path.AppendASCII(gin::IsolateHolder::kNativesFileName);
base::FilePath v8_snapshot_data_path =
v8_data_path.AppendASCII(gin::IsolateHolder::kSnapshotFileName);
base::File v8_natives_data_file(v8_natives_data_path, file_flags);
base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags);
DCHECK(v8_natives_data_file.IsValid());
DCHECK(v8_snapshot_data_file.IsValid());
v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile());
v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile());
}
mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
}
#endif

} // namespace brightray
12 changes: 12 additions & 0 deletions browser/browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@ class BrowserClient : public content::ContentBrowserClient {
base::FilePath GetDefaultDownloadDirectory() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;

#if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line,
int child_process_id,
content::FileDescriptorInfo* mappings) override;
#endif

BrowserMainParts* browser_main_parts_;

#if defined(OS_POSIX) && !defined(OS_MACOSX)
base::ScopedFD v8_natives_fd_;
base::ScopedFD v8_snapshot_fd_;
#endif // OS_POSIX && !OS_MACOSX

DISALLOW_COPY_AND_ASSIGN(BrowserClient);
};

Expand Down
28 changes: 14 additions & 14 deletions browser/devtools_manager_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,24 @@ const char kTargetTypeOther[] = "other";
class TCPServerSocketFactory
: public content::DevToolsHttpHandler::ServerSocketFactory {
public:
TCPServerSocketFactory(const std::string& address, int port, int backlog)
: content::DevToolsHttpHandler::ServerSocketFactory(
address, port, backlog) {}
TCPServerSocketFactory(const std::string& address, int port)
: address_(address), port_(port) {
}

private:
// content::DevToolsHttpHandler::ServerSocketFactory.
scoped_ptr<net::ServerSocket> Create() const override {
return scoped_ptr<net::ServerSocket>(
new net::TCPServerSocket(NULL, net::NetLog::Source()));
scoped_ptr<net::ServerSocket> CreateForHttpServer() override {
scoped_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLog::Source()));
if (socket->ListenWithAddressAndPort(address_, port_, 10) != net::OK)
return scoped_ptr<net::ServerSocket>();

return socket;
}

std::string address_;
uint16 port_;

DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
};

Expand All @@ -82,7 +89,7 @@ CreateSocketFactory() {
}
}
return scoped_ptr<content::DevToolsHttpHandler::ServerSocketFactory>(
new TCPServerSocketFactory("127.0.0.1", port, 1));
new TCPServerSocketFactory("127.0.0.1", port));
}

class Target : public content::DevToolsTarget {
Expand Down Expand Up @@ -152,8 +159,6 @@ class DevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
std::string GetDiscoveryPageHTML() override;
bool BundlesFrontendResources() override;
base::FilePath GetDebugFrontendDir() override;
scoped_ptr<net::ServerSocket> CreateSocketForTethering(
std::string* name) override;

private:
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
Expand All @@ -178,11 +183,6 @@ base::FilePath DevToolsDelegate::GetDebugFrontendDir() {
return base::FilePath();
}

scoped_ptr<net::ServerSocket> DevToolsDelegate::CreateSocketForTethering(
std::string* name) {
return scoped_ptr<net::ServerSocket>();
}

} // namespace

// DevToolsManagerDelegate ---------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions browser/inspectable_web_contents_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ void InspectableWebContentsImpl::AgentHostClosed(
}

void InspectableWebContentsImpl::AboutToNavigateRenderFrame(
content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) {
if (new_host->GetParent())
return;
Expand Down
3 changes: 2 additions & 1 deletion browser/inspectable_web_contents_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class InspectableWebContentsImpl :
bool replaced) override;

// content::WebContentsObserver:
void AboutToNavigateRenderFrame(content::RenderFrameHost* new_host) override;
void AboutToNavigateRenderFrame(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override;
void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override;
void WebContentsDestroyed() override;
Expand Down
15 changes: 10 additions & 5 deletions browser/platform_notification_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ NotificationPresenter* PlatformNotificationServiceImpl::notification_presenter()
return notification_presenter_.get();
}

blink::WebNotificationPermission PlatformNotificationServiceImpl::CheckPermission(
blink::WebNotificationPermission PlatformNotificationServiceImpl::CheckPermissionOnUIThread(
content::BrowserContext* browser_context,
const GURL& origin,
int render_process_id) {
return blink::WebNotificationPermissionAllowed;
}

blink::WebNotificationPermission PlatformNotificationServiceImpl::CheckPermissionOnIOThread(
content::ResourceContext* resource_context,
const GURL& origin,
int render_process_id) {
Expand All @@ -40,7 +47,6 @@ void PlatformNotificationServiceImpl::DisplayNotification(
const SkBitmap& icon,
const content::PlatformNotificationData& notification_data,
scoped_ptr<content::DesktopNotificationDelegate> delegate,
int render_process_id,
base::Closure* cancel_callback) {
auto presenter = notification_presenter();
if (presenter)
Expand All @@ -49,11 +55,10 @@ void PlatformNotificationServiceImpl::DisplayNotification(

void PlatformNotificationServiceImpl::DisplayPersistentNotification(
content::BrowserContext* browser_context,
int64 service_worker_registration_id,
int64_t service_worker_registration_id,
const GURL& origin,
const SkBitmap& icon,
const content::PlatformNotificationData& notification_data,
int render_process_id) {
const content::PlatformNotificationData& notification_data) {
}

void PlatformNotificationServiceImpl::ClosePersistentNotification(
Expand Down
18 changes: 10 additions & 8 deletions browser/platform_notification_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,28 @@ class PlatformNotificationServiceImpl
~PlatformNotificationServiceImpl() override;

// content::PlatformNotificationService:
virtual blink::WebNotificationPermission CheckPermission(
blink::WebNotificationPermission CheckPermissionOnUIThread(
content::BrowserContext* browser_context,
const GURL& origin,
int render_process_id) override;
blink::WebNotificationPermission CheckPermissionOnIOThread(
content::ResourceContext* resource_context,
const GURL& origin,
int render_process_id) override;
virtual void DisplayNotification(
void DisplayNotification(
content::BrowserContext* browser_context,
const GURL& origin,
const SkBitmap& icon,
const content::PlatformNotificationData& notification_data,
scoped_ptr<content::DesktopNotificationDelegate> delegate,
int render_process_id,
base::Closure* cancel_callback) override;
virtual void DisplayPersistentNotification(
void DisplayPersistentNotification(
content::BrowserContext* browser_context,
int64 service_worker_registration_id,
int64_t service_worker_registration_id,
const GURL& origin,
const SkBitmap& icon,
const content::PlatformNotificationData& notification_data,
int render_process_id) override;
virtual void ClosePersistentNotification(
const content::PlatformNotificationData& notification_data) override;
void ClosePersistentNotification(
content::BrowserContext* browser_context,
const std::string& persistent_notification_id) override;

Expand Down
6 changes: 3 additions & 3 deletions browser/url_request_context_getter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
NULL, NULL);
storage_->set_cookie_store(content::CreateCookieStore(cookie_config));
storage_->set_channel_id_service(new net::ChannelIDService(
new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
storage_->set_channel_id_service(make_scoped_ptr(
new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true))));
storage_->set_http_user_agent_settings(new net::StaticHttpUserAgentSettings(
"en-us,en", base::EmptyString()));

Expand Down
2 changes: 1 addition & 1 deletion vendor/libchromiumcontent

0 comments on commit dadcb46

Please sign in to comment.