From ed68bd18b88f349a7348006a2e14cdddbc993da7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 13:33:03 +0800 Subject: [PATCH 01/15] Upgrade libchromiumcontent to Chrome 37. --- script/lib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/config.py b/script/lib/config.py index 1bec67c2419..d6d0823b39e 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -5,7 +5,7 @@ import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = 'afb4570ceee2ad10f3caf5a81335a2ee11ec68a5' +LIBCHROMIUMCONTENT_COMMIT = 'ea1a7e85a3de1878e5656110c76f4d2d8af41c6e' ARCH = { 'cygwin': '32bit', From fe88330e87b25249425b333955370466835b4e7b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 13:59:01 +0800 Subject: [PATCH 02/15] Upgrade brightray to Chrome 37. --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index de769889118..373c09efc7c 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit de769889118c6e68ecb0c729be5ab6caef333bf6 +Subproject commit 373c09efc7c554fd9aae1d84482f7907d9eef03e From 55003716aa48a1250f617ba661ee5c747ceec304 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 15:08:19 +0800 Subject: [PATCH 03/15] Upgrade node for Chrome 37. --- vendor/node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/node b/vendor/node index 6d772c3cda0..7297b341778 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit 6d772c3cda0bb8270857397e128ea1e36c361125 +Subproject commit 7297b341778d8c0f8828a396889635cc3f537387 From 134f8236cc77e52e9a44a6bbc90af8a4b083c23a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 15:35:39 +0800 Subject: [PATCH 04/15] Update printing code to Chrome 37. --- .../chrome/browser/printing/print_job.cc | 6 +- .../browser/printing/print_job_worker.cc | 40 +++---------- .../printing/print_view_manager_base.cc | 58 +++++++++++++------ .../printing/print_view_manager_base.h | 8 +-- .../printing/printing_message_filter.cc | 5 +- .../printing/printing_message_filter.h | 3 +- 6 files changed, 61 insertions(+), 59 deletions(-) diff --git a/chromium_src/chrome/browser/printing/print_job.cc b/chromium_src/chrome/browser/printing/print_job.cc index 0171951e2b2..4a58440685b 100644 --- a/chromium_src/chrome/browser/printing/print_job.cc +++ b/chromium_src/chrome/browser/printing/print_job.cc @@ -12,6 +12,7 @@ #include "base/timer/timer.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/printing/print_job_worker.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "printing/printed_document.h" #include "printing/printed_page.h" @@ -69,7 +70,10 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job, settings_ = job->settings(); PrintedDocument* new_doc = - new PrintedDocument(settings_, source_, job->cookie()); + new PrintedDocument(settings_, + source_, + job->cookie(), + content::BrowserThread::GetBlockingPool()); new_doc->set_page_count(page_count); UpdatePrintedDocument(new_doc); diff --git a/chromium_src/chrome/browser/printing/print_job_worker.cc b/chromium_src/chrome/browser/printing/print_job_worker.cc index abef9893aa1..a14c87c794e 100644 --- a/chromium_src/chrome/browser/printing/print_job_worker.cc +++ b/chromium_src/chrome/browser/printing/print_job_worker.cc @@ -120,39 +120,19 @@ void PrintJobWorker::SetSettings( DCHECK_EQ(message_loop(), base::MessageLoop::current()); BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), + BrowserThread::UI, + FROM_HERE, + base::Bind(&HoldRefCallback, + make_scoped_refptr(owner_), base::Bind(&PrintJobWorker::UpdatePrintSettings, - base::Unretained(this), new_settings))); + base::Unretained(this), + base::Owned(new_settings)))); } void PrintJobWorker::UpdatePrintSettings( const base::DictionaryValue* const new_settings) { - // Create new PageRanges based on |new_settings|. - PageRanges new_ranges; - const base::ListValue* page_range_array; - if (new_settings->GetList(kSettingPageRange, &page_range_array)) { - for (size_t index = 0; index < page_range_array->GetSize(); ++index) { - const base::DictionaryValue* dict; - if (!page_range_array->GetDictionary(index, &dict)) - continue; - - PageRange range; - if (!dict->GetInteger(kSettingPageRangeFrom, &range.from) || - !dict->GetInteger(kSettingPageRangeTo, &range.to)) { - continue; - } - - // Page numbers are 1-based in the dictionary. - // Page numbers are 0-based for the printing context. - range.from--; - range.to--; - new_ranges.push_back(range); - } - } PrintingContext::Result result = - printing_context_->UpdatePrintSettings(*new_settings, new_ranges); - delete new_settings; + printing_context_->UpdatePrintSettings(*new_settings); GetSettingsDone(result); } @@ -218,8 +198,6 @@ void PrintJobWorker::StartPrinting(PrintedDocument* new_document) { base::string16 document_name = printing::SimplifyDocumentTitle(document_->name()); if (document_name.empty()) { - // document_name = printing::SimplifyDocumentTitle( - // l10n_util::GetStringUTF16(IDS_DEFAULT_PRINT_DOCUMENT_TITLE)); } PrintingContext::Result result = printing_context_->NewDocument(document_name); @@ -272,8 +250,8 @@ void PrintJobWorker::OnNewPage() { while (true) { // Is the page available? - scoped_refptr page; - if (!document_->GetPage(page_number_.ToInt(), &page)) { + scoped_refptr page = document_->GetPage(page_number_.ToInt()); + if (!page) { // We need to wait for the page to be available. base::MessageLoop::current()->PostDelayedTask( FROM_HERE, diff --git a/chromium_src/chrome/browser/printing/print_view_manager_base.cc b/chromium_src/chrome/browser/printing/print_view_manager_base.cc index c987d8e0d1c..db77791ba7e 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.cc +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.cc @@ -4,8 +4,6 @@ #include "chrome/browser/printing/print_view_manager_base.h" -#include - #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/prefs/pref_service.h" @@ -34,12 +32,16 @@ using base::TimeDelta; using content::BrowserThread; -#if defined(OS_WIN) +namespace printing { + +namespace { + +#if defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING) // Limits memory usage by raster to 64 MiB. const int kMaxRasterSizeInPixels = 16*1024*1024; #endif -namespace printing { +} // namespace PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) : content::WebContentsObserver(web_contents), @@ -49,7 +51,8 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) cookie_(0), queue_(g_browser_process->print_job_manager()->queue()) { DCHECK(queue_); -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \ + defined(WIN_PDF_METAFILE_FOR_PRINTING) expecting_first_page_ = true; #endif printing_enabled_ = true; @@ -103,7 +106,7 @@ void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) { } void PrintViewManagerBase::OnDidPrintPage( - const PrintHostMsg_DidPrintPage_Params& params) { + const PrintHostMsg_DidPrintPage_Params& params) { if (!OpportunisticallyCreatePrintJob(params.document_cookie)) return; @@ -114,9 +117,10 @@ void PrintViewManagerBase::OnDidPrintPage( return; } -#if defined(OS_WIN) || defined(OS_MACOSX) +#if (defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING)) || \ + defined(OS_MACOSX) const bool metafile_must_be_valid = true; -#elif defined(OS_POSIX) +#elif defined(OS_POSIX) || defined(WIN_PDF_METAFILE_FOR_PRINTING) const bool metafile_must_be_valid = expecting_first_page_; expecting_first_page_ = false; #endif @@ -139,10 +143,10 @@ void PrintViewManagerBase::OnDidPrintPage( } } -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(WIN_PDF_METAFILE_FOR_PRINTING) bool big_emf = (params.data_size && params.data_size >= kMetafileMaxSize); - int raster_size = std::min(params.page_size.GetArea(), - kMaxRasterSizeInPixels); + int raster_size = + std::min(params.page_size.GetArea(), kMaxRasterSizeInPixels); if (big_emf) { scoped_ptr raster_metafile( metafile->RasterizeMetafile(raster_size)); @@ -156,16 +160,39 @@ void PrintViewManagerBase::OnDidPrintPage( return; } } -#endif +#endif // OS_WIN && !WIN_PDF_METAFILE_FOR_PRINTING +#if !defined(WIN_PDF_METAFILE_FOR_PRINTING) // Update the rendered document. It will send notifications to the listener. document->SetPage(params.page_number, metafile.release(), +#if defined(OS_WIN) params.actual_shrink, +#endif // OS_WIN params.page_size, params.content_area); ShouldQuitFromInnerMessageLoop(); +#else + if (metafile_must_be_valid) { + scoped_refptr bytes = new base::RefCountedBytes( + reinterpret_cast(shared_buf.memory()), + params.data_size); + + document->DebugDumpData(bytes, FILE_PATH_LITERAL(".pdf")); + + if (!pdf_to_emf_converter_) + pdf_to_emf_converter_ = PdfToEmfConverter::CreateDefault(); + + const int kPrinterDpi = print_job_->settings().dpi(); + pdf_to_emf_converter_->Start( + bytes, + printing::PdfRenderSettings(params.content_area, kPrinterDpi, true), + base::Bind(&PrintViewManagerBase::OnPdfToEmfConverted, + base::Unretained(this), + params)); + } +#endif // !WIN_PDF_METAFILE_FOR_PRINTING } void PrintViewManagerBase::OnPrintingFailed(int cookie) { @@ -186,10 +213,6 @@ void PrintViewManagerBase::OnShowInvalidPrinterSettingsError() { LOG(ERROR) << "Invalid printer settings"; } -void PrintViewManagerBase::DidStartLoading( - content::RenderViewHost* render_view_host) { -} - bool PrintViewManagerBase::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBase, message) @@ -363,7 +386,8 @@ void PrintViewManagerBase::DisconnectFromCurrentPrintJob() { // DO NOT wait for the job to finish. ReleasePrintJob(); } -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \ + defined(WIN_PDF_METAFILE_FOR_PRINTING) expecting_first_page_ = true; #endif } diff --git a/chromium_src/chrome/browser/printing/print_view_manager_base.h b/chromium_src/chrome/browser/printing/print_view_manager_base.h index 17cc5809294..61b0fd44008 100644 --- a/chromium_src/chrome/browser/printing/print_view_manager_base.h +++ b/chromium_src/chrome/browser/printing/print_view_manager_base.h @@ -23,6 +23,7 @@ class RenderViewHost; namespace printing { class JobEventDetails; +class PdfToEmfConverter; class PrintJob; class PrintJobWorkerOwner; class PrintQueriesQueue; @@ -63,10 +64,6 @@ class PrintViewManagerBase : public content::NotificationObserver, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // content::WebContentsObserver implementation. - virtual void DidStartLoading( - content::RenderViewHost* render_view_host) OVERRIDE; - // Cancels the print job. virtual void NavigationStopped() OVERRIDE; @@ -143,7 +140,8 @@ class PrintViewManagerBase : public content::NotificationObserver, // print settings are being loaded. bool inside_inner_message_loop_; -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if (defined(OS_POSIX) && !defined(OS_MACOSX)) || \ + defined(WIN_PDF_METAFILE_FOR_PRINTING) // Set to true when OnDidPrintPage() should be expecting the first page. bool expecting_first_page_; #endif diff --git a/chromium_src/chrome/browser/printing/printing_message_filter.cc b/chromium_src/chrome/browser/printing/printing_message_filter.cc index 18068a1fa94..d10843fe3c7 100644 --- a/chromium_src/chrome/browser/printing/printing_message_filter.cc +++ b/chromium_src/chrome/browser/printing/printing_message_filter.cc @@ -63,10 +63,9 @@ PrintingMessageFilter::PrintingMessageFilter(int render_process_id) PrintingMessageFilter::~PrintingMessageFilter() { } -bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message, - bool* message_was_ok) { +bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP_EX(PrintingMessageFilter, message, *message_was_ok) + IPC_BEGIN_MESSAGE_MAP(PrintingMessageFilter, message) #if defined(OS_WIN) IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) #endif diff --git a/chromium_src/chrome/browser/printing/printing_message_filter.h b/chromium_src/chrome/browser/printing/printing_message_filter.h index 0f587d87e1a..8a9d9c2d1ec 100644 --- a/chromium_src/chrome/browser/printing/printing_message_filter.h +++ b/chromium_src/chrome/browser/printing/printing_message_filter.h @@ -38,8 +38,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { explicit PrintingMessageFilter(int render_process_id); // content::BrowserMessageFilter methods. - virtual bool OnMessageReceived(const IPC::Message& message, - bool* message_was_ok) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; private: virtual ~PrintingMessageFilter(); From d4a46fa35fc4e9d3d09856f7f5968006910b53c0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 15:35:56 +0800 Subject: [PATCH 05/15] Comment out debugger agent. V8 has discarded support for debugger agent, we should reimplement it in atom-shell. --- atom/browser/node_debugger.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/atom/browser/node_debugger.cc b/atom/browser/node_debugger.cc index f66a2d06389..0e7d58b1dd4 100644 --- a/atom/browser/node_debugger.cc +++ b/atom/browser/node_debugger.cc @@ -44,10 +44,12 @@ NodeDebugger::NodeDebugger() { if (use_debug_agent) { if (!port_str.empty()) base::StringToInt(port_str, &port); +#if 0 v8::Debug::EnableAgent("atom-shell " ATOM_VERSION, port, wait_for_connection); v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessagesInMsgThread, false); +#endif } } From 3e46363ae19011718c5d4941239a164eda7167bf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 15:36:37 +0800 Subject: [PATCH 06/15] Fix API changes of Chrome 37. --- atom/browser/atom_browser_context.cc | 13 +++++++------ atom/browser/atom_browser_context.h | 2 +- atom/renderer/atom_render_view_observer.h | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index bcd10ed6b7d..d3b40fe1ef9 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -13,7 +13,8 @@ #include "content/public/common/url_constants.h" #include "net/url_request/data_protocol_handler.h" #include "net/url_request/file_protocol_handler.h" -#include "net/url_request/protocol_intercept_job_factory.h" +#include "net/url_request/url_request_intercepting_job_factory.h" +#include "url/url_constants.h" using content::BrowserThread; @@ -29,7 +30,7 @@ AtomBrowserContext::~AtomBrowserContext() { net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory( content::ProtocolHandlerMap* handlers, - content::ProtocolHandlerScopedVector* interceptors) { + content::URLRequestInterceptorScopedVector* interceptors) { scoped_ptr job_factory(job_factory_); for (content::ProtocolHandlerMap::iterator it = handlers->begin(); @@ -38,18 +39,18 @@ net::URLRequestJobFactory* AtomBrowserContext::CreateURLRequestJobFactory( handlers->clear(); job_factory->SetProtocolHandler( - content::kDataScheme, new net::DataProtocolHandler); + url::kDataScheme, new net::DataProtocolHandler); job_factory->SetProtocolHandler( - content::kFileScheme, new net::FileProtocolHandler( + url::kFileScheme, new net::FileProtocolHandler( BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); // Set up interceptors in the reverse order. scoped_ptr top_job_factory = job_factory.PassAs(); - content::ProtocolHandlerScopedVector::reverse_iterator it; + content::URLRequestInterceptorScopedVector::reverse_iterator it; for (it = interceptors->rbegin(); it != interceptors->rend(); ++it) - top_job_factory.reset(new net::ProtocolInterceptJobFactory( + top_job_factory.reset(new net::URLRequestInterceptingJobFactory( top_job_factory.Pass(), make_scoped_ptr(*it))); interceptors->weak_clear(); diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index 06860937460..95db71ff699 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -27,7 +27,7 @@ class AtomBrowserContext : public brightray::BrowserContext { // brightray::URLRequestContextGetter::Delegate: virtual net::URLRequestJobFactory* CreateURLRequestJobFactory( content::ProtocolHandlerMap* handlers, - content::ProtocolHandlerScopedVector* interceptors) OVERRIDE; + content::URLRequestInterceptorScopedVector* interceptors) OVERRIDE; private: // A fake BrowserProcess object that used to feed the source code from chrome. diff --git a/atom/renderer/atom_render_view_observer.h b/atom/renderer/atom_render_view_observer.h index 1e1f356f02f..6a6dbb5ed8b 100644 --- a/atom/renderer/atom_render_view_observer.h +++ b/atom/renderer/atom_render_view_observer.h @@ -5,6 +5,7 @@ #ifndef ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_ #define ATOM_RENDERER_ATOM_RENDER_VIEW_OBSERVER_H_ +#include "base/strings/string16.h" #include "content/public/renderer/render_view_observer.h" namespace base { From d874ba80db5bedb67b0b50cea431321c77b10f5d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 16:08:08 +0800 Subject: [PATCH 07/15] Upgrade libchromiumcontent for gin headers. --- script/lib/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/lib/config.py b/script/lib/config.py index d6d0823b39e..63954b2fa88 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -5,7 +5,7 @@ import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = 'ea1a7e85a3de1878e5656110c76f4d2d8af41c6e' +LIBCHROMIUMCONTENT_COMMIT = '2cf80c1743e370c12eb7bf078eb425f3cc355383' ARCH = { 'cygwin': '32bit', From 241b07f76342db7f8c7e8373ab46b157e3b7c4a0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 16:41:26 +0800 Subject: [PATCH 08/15] Initailize V8 with gin. --- atom/browser/javascript_environment.cc | 4 +++- atom/browser/javascript_environment.h | 4 +++- atom/common/api/atom_bindings.cc | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/atom/browser/javascript_environment.cc b/atom/browser/javascript_environment.cc index ddc29afcc45..dbaeb57dd65 100644 --- a/atom/browser/javascript_environment.cc +++ b/atom/browser/javascript_environment.cc @@ -7,7 +7,9 @@ namespace atom { JavascriptEnvironment::JavascriptEnvironment() - : isolate_(v8::Isolate::GetCurrent()), + : isolate_holder_(gin::IsolateHolder::kNonStrictMode), + isolate_(isolate_holder_.isolate()), + isolate_scope_(isolate_), locker_(isolate_), handle_scope_(isolate_), context_(isolate_, v8::Context::New(isolate_)), diff --git a/atom/browser/javascript_environment.h b/atom/browser/javascript_environment.h index 67cab80598f..5f725ba7d11 100644 --- a/atom/browser/javascript_environment.h +++ b/atom/browser/javascript_environment.h @@ -6,7 +6,7 @@ #define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_ #include "base/basictypes.h" -#include "v8/include/v8.h" +#include "gin/public/isolate_holder.h" namespace atom { @@ -20,7 +20,9 @@ class JavascriptEnvironment { } private: + gin::IsolateHolder isolate_holder_; v8::Isolate* isolate_; + v8::Isolate::Scope isolate_scope_; v8::Locker locker_; v8::HandleScope handle_scope_; v8::UniquePersistent context_; diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index 3f274cc1c11..0390d863a69 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -61,7 +61,6 @@ AtomBindings::AtomBindings() { call_next_tick_async_.data = this; uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback); - v8::V8::SetFatalErrorHandler(FatalErrorCallback); } AtomBindings::~AtomBindings() { @@ -69,6 +68,8 @@ AtomBindings::~AtomBindings() { void AtomBindings::BindTo(v8::Isolate* isolate, v8::Handle process) { + v8::V8::SetFatalErrorHandler(FatalErrorCallback); + mate::Dictionary dict(isolate, process); dict.SetMethod("crash", &Crash); dict.SetMethod("log", &Log); From a413935e919abe3aa2970a5fc36901639fb87c4e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 18:43:43 +0800 Subject: [PATCH 09/15] Initialize node after WebKit is initialized. --- atom/renderer/atom_renderer_client.cc | 10 ++++++++-- atom/renderer/atom_renderer_client.h | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 4c0a3f201ca..8739efef457 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -14,10 +14,12 @@ #include "chrome/renderer/printing/print_web_view_helper.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame_observer.h" +#include "content/public/renderer/render_thread.h" #include "base/command_line.h" #include "native_mate/converter.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebKit.h" #include "atom/common/node_includes.h" @@ -83,7 +85,7 @@ AtomRendererClient::AtomRendererClient() AtomRendererClient::~AtomRendererClient() { } -void AtomRendererClient::RenderThreadStarted() { +void AtomRendererClient::WebKitInitialized() { if (!IsNodeBindingEnabled()) return; @@ -94,12 +96,16 @@ void AtomRendererClient::RenderThreadStarted() { // Create a default empty environment which would be used when we need to // run V8 code out of a window context (like running a uv callback). - v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Isolate* isolate = blink::mainThreadIsolate(); v8::HandleScope handle_scope(isolate); v8::Local context = v8::Context::New(isolate); global_env = node::Environment::New(context); } +void AtomRendererClient::RenderThreadStarted() { + content::RenderThread::Get()->AddObserver(this); +} + void AtomRendererClient::RenderFrameCreated( content::RenderFrame* render_frame) { new AtomRenderFrameObserver(render_frame, this); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index dd143d1a4a9..818c65ed6be 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -9,6 +9,7 @@ #include #include "content/public/renderer/content_renderer_client.h" +#include "content/public/renderer/render_process_observer.h" namespace node { class Environment; @@ -19,7 +20,8 @@ namespace atom { class AtomRendererBindings; class NodeBindings; -class AtomRendererClient : public content::ContentRendererClient { +class AtomRendererClient : public content::ContentRendererClient, + public content::RenderProcessObserver { public: AtomRendererClient(); virtual ~AtomRendererClient(); @@ -41,6 +43,9 @@ class AtomRendererClient : public content::ContentRendererClient { DISABLE, }; + // content::RenderProcessObserver: + virtual void WebKitInitialized() OVERRIDE; + // content::ContentRendererClient: virtual void RenderThreadStarted() OVERRIDE; virtual void RenderFrameCreated(content::RenderFrame* render_frame) OVERRIDE; From 48a5591508fcd0fa1c7728b1b60fa2546e98f809 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 19:18:45 +0800 Subject: [PATCH 10/15] Upgrade brightray. --- atom/common/chrome_version.h | 2 +- vendor/brightray | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atom/common/chrome_version.h b/atom/common/chrome_version.h index a8f70f3ce00..4909ed58036 100644 --- a/atom/common/chrome_version.h +++ b/atom/common/chrome_version.h @@ -8,7 +8,7 @@ #ifndef ATOM_COMMON_CHROME_VERSION_H_ #define ATOM_COMMON_CHROME_VERSION_H_ -#define CHROME_VERSION_STRING "36.0.1985.125" +#define CHROME_VERSION_STRING "37.0.2062.102" #define CHROME_VERSION "v" CHROME_VERSION_STRING #endif // ATOM_COMMON_CHROME_VERSION_H_ diff --git a/vendor/brightray b/vendor/brightray index 373c09efc7c..759cf77253e 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 373c09efc7c554fd9aae1d84482f7907d9eef03e +Subproject commit 759cf77253e8d3996745b6f6aeedcf3cb9465bbb From 9546120ce410b3fc27f1d476b0908ea1ddb99e73 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 20:10:14 +0800 Subject: [PATCH 11/15] linux: Fix API changes of Chrome 37. --- atom/browser/native_window_views.cc | 1 - atom/browser/ui/message_box_views.cc | 5 ++--- atom/browser/ui/views/frameless_view.cc | 6 +++--- atom/browser/ui/views/frameless_view.h | 6 +++--- atom/browser/ui/views/menu_bar.cc | 8 ++++---- atom/browser/ui/views/menu_delegate.cc | 2 +- atom/browser/ui/views/menu_delegate.h | 2 +- atom/browser/ui/views/menu_layout.cc | 5 +++-- atom/browser/ui/views/menu_layout.h | 5 +++-- atom/browser/ui/views/submenu_button.cc | 5 +++-- atom/browser/ui/views/submenu_button.h | 3 +++ vendor/brightray | 2 +- 12 files changed, 27 insertions(+), 23 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 5524711fdd6..3c1cd30c235 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -145,7 +145,6 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, params.bounds = bounds; params.delegate = this; params.type = views::Widget::InitParams::TYPE_WINDOW; - params.top_level = true; params.remove_standard_frame = !has_frame_; #if defined(USE_X11) diff --git a/atom/browser/ui/message_box_views.cc b/atom/browser/ui/message_box_views.cc index c050a3dd3c3..a807eaac0cf 100644 --- a/atom/browser/ui/message_box_views.cc +++ b/atom/browser/ui/message_box_views.cc @@ -71,7 +71,7 @@ class MessageDialog : public views::WidgetDelegate, virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE; // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual gfx::Size GetPreferredSize() const OVERRIDE; virtual void Layout() OVERRIDE; virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; @@ -160,7 +160,6 @@ MessageDialog::MessageDialog(NativeWindow* parent_window, views::Widget::InitParams params; params.delegate = this; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; - params.top_level = true; if (parent_) { params.parent = parent_->GetNativeWindow(); params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; @@ -264,7 +263,7 @@ views::ClientView* MessageDialog::CreateClientView(views::Widget* widget) { return new MessageDialogClientView(this, widget); } -gfx::Size MessageDialog::GetPreferredSize() { +gfx::Size MessageDialog::GetPreferredSize() const { gfx::Size size(0, buttons_[0]->GetPreferredSize().height()); for (size_t i = 0; i < buttons_.size(); ++i) size.Enlarge(buttons_[i]->GetPreferredSize().width(), 0); diff --git a/atom/browser/ui/views/frameless_view.cc b/atom/browser/ui/views/frameless_view.cc index a7c5f3c1765..b02ec299dab 100644 --- a/atom/browser/ui/views/frameless_view.cc +++ b/atom/browser/ui/views/frameless_view.cc @@ -95,16 +95,16 @@ void FramelessView::UpdateWindowIcon() { void FramelessView::UpdateWindowTitle() { } -gfx::Size FramelessView::GetPreferredSize() { +gfx::Size FramelessView::GetPreferredSize() const { return frame_->non_client_view()->GetWindowBoundsForClientBounds( gfx::Rect(frame_->client_view()->GetPreferredSize())).size(); } -gfx::Size FramelessView::GetMinimumSize() { +gfx::Size FramelessView::GetMinimumSize() const { return window_->GetMinimumSize(); } -gfx::Size FramelessView::GetMaximumSize() { +gfx::Size FramelessView::GetMaximumSize() const { return window_->GetMaximumSize(); } diff --git a/atom/browser/ui/views/frameless_view.h b/atom/browser/ui/views/frameless_view.h index 93b86f73774..d9013d81555 100644 --- a/atom/browser/ui/views/frameless_view.h +++ b/atom/browser/ui/views/frameless_view.h @@ -38,9 +38,9 @@ class FramelessView : public views::NonClientFrameView { virtual void UpdateWindowTitle() OVERRIDE; // Overridden from View: - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual gfx::Size GetMinimumSize() OVERRIDE; - virtual gfx::Size GetMaximumSize() OVERRIDE; + virtual gfx::Size GetPreferredSize() const OVERRIDE; + virtual gfx::Size GetMinimumSize() const OVERRIDE; + virtual gfx::Size GetMaximumSize() const OVERRIDE; virtual const char* GetClassName() const OVERRIDE; // Not owned. diff --git a/atom/browser/ui/views/menu_bar.cc b/atom/browser/ui/views/menu_bar.cc index 0cfa71e0364..dbbce6e0e24 100644 --- a/atom/browser/ui/views/menu_bar.cc +++ b/atom/browser/ui/views/menu_bar.cc @@ -74,10 +74,10 @@ void MenuBar::SetMenu(ui::MenuModel* model) { button->set_tag(i); #if defined(USE_X11) - button->SetEnabledColor(enabled_color_); - button->SetDisabledColor(disabled_color_); - button->SetHighlightColor(highlight_color_); - button->SetHoverColor(hover_color_); + button->SetTextColor(views::Button::STATE_NORMAL, enabled_color_); + button->SetTextColor(views::Button::STATE_DISABLED, disabled_color_); + button->SetTextColor(views::Button::STATE_PRESSED, highlight_color_); + button->SetTextColor(views::Button::STATE_HOVERED, hover_color_); button->SetUnderlineColor(enabled_color_); #elif defined(OS_WIN) button->SetUnderlineColor(color_utils::GetSysSkColor(COLOR_GRAYTEXT)); diff --git a/atom/browser/ui/views/menu_delegate.cc b/atom/browser/ui/views/menu_delegate.cc index e01a9d4c525..88d1b689b5c 100644 --- a/atom/browser/ui/views/menu_delegate.cc +++ b/atom/browser/ui/views/menu_delegate.cc @@ -73,7 +73,7 @@ bool MenuDelegate::IsTriggerableEvent(views::MenuItemView* source, return delegate()->IsTriggerableEvent(source, e); } -bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) { +bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) const { return delegate()->GetAccelerator(id, accelerator); } diff --git a/atom/browser/ui/views/menu_delegate.h b/atom/browser/ui/views/menu_delegate.h index ca6492cbc6c..cad6017b9bd 100644 --- a/atom/browser/ui/views/menu_delegate.h +++ b/atom/browser/ui/views/menu_delegate.h @@ -35,7 +35,7 @@ class MenuDelegate : public views::MenuDelegate { virtual bool IsTriggerableEvent(views::MenuItemView* source, const ui::Event& e) OVERRIDE; virtual bool GetAccelerator(int id, - ui::Accelerator* accelerator) OVERRIDE; + ui::Accelerator* accelerator) const OVERRIDE; virtual base::string16 GetLabel(int id) const OVERRIDE; virtual const gfx::FontList* GetLabelFontList(int id) const OVERRIDE; virtual bool IsCommandEnabled(int id) const OVERRIDE; diff --git a/atom/browser/ui/views/menu_layout.cc b/atom/browser/ui/views/menu_layout.cc index 5ed015fb871..7215cee1c87 100644 --- a/atom/browser/ui/views/menu_layout.cc +++ b/atom/browser/ui/views/menu_layout.cc @@ -30,7 +30,7 @@ void MenuLayout::Layout(views::View* host) { menu_bar->SetBoundsRect(menu_Bar_bounds); } -gfx::Size MenuLayout::GetPreferredSize(views::View* host) { +gfx::Size MenuLayout::GetPreferredSize(const views::View* host) const { gfx::Size size = views::FillLayout::GetPreferredSize(host); if (!HasMenu(host)) return size; @@ -39,7 +39,8 @@ gfx::Size MenuLayout::GetPreferredSize(views::View* host) { return size; } -int MenuLayout::GetPreferredHeightForWidth(views::View* host, int width) { +int MenuLayout::GetPreferredHeightForWidth( + const views::View* host, int width) const { int height = views::FillLayout::GetPreferredHeightForWidth(host, width); if (!HasMenu(host)) return height; diff --git a/atom/browser/ui/views/menu_layout.h b/atom/browser/ui/views/menu_layout.h index 1b3d78e28d9..d01ccd60919 100644 --- a/atom/browser/ui/views/menu_layout.h +++ b/atom/browser/ui/views/menu_layout.h @@ -16,8 +16,9 @@ class MenuLayout : public views::FillLayout { // views::LayoutManager: virtual void Layout(views::View* host) OVERRIDE; - virtual gfx::Size GetPreferredSize(views::View* host) OVERRIDE; - virtual int GetPreferredHeightForWidth(views::View* host, int width) OVERRIDE; + virtual gfx::Size GetPreferredSize(const views::View* host) const OVERRIDE; + virtual int GetPreferredHeightForWidth( + const views::View* host, int width) const OVERRIDE; private: bool HasMenu(const views::View* host) const; diff --git a/atom/browser/ui/views/submenu_button.cc b/atom/browser/ui/views/submenu_button.cc index 4d3fd579e08..5049ffb0f48 100644 --- a/atom/browser/ui/views/submenu_button.cc +++ b/atom/browser/ui/views/submenu_button.cc @@ -34,9 +34,10 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener, text_width_(0), text_height_(0), underline_color_(SK_ColorBLACK) { + SetStyle(views::Button::STYLE_TEXTBUTTON); if (GetUnderlinePosition(title, &accelerator_, &underline_start_, &underline_end_)) - gfx::Canvas::SizeStringInt(text(), font_list(), &text_width_, + gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_, &text_height_, 0, 0); } @@ -85,7 +86,7 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text, void SubmenuButton::GetCharacterPosition( const base::string16& text, int index, int* pos) { int height; - gfx::Canvas::SizeStringInt(text.substr(0, index), font_list(), pos, &height, + gfx::Canvas::SizeStringInt(text.substr(0, index), GetFontList(), pos, &height, 0, 0); } diff --git a/atom/browser/ui/views/submenu_button.h b/atom/browser/ui/views/submenu_button.h index 457857c034a..cb439218d48 100644 --- a/atom/browser/ui/views/submenu_button.h +++ b/atom/browser/ui/views/submenu_button.h @@ -20,6 +20,9 @@ class SubmenuButton : public views::MenuButton { void SetAcceleratorVisibility(bool visible); void SetUnderlineColor(SkColor color); + void SetEnabledColor(SkColor color); + void SetBackgroundColor(SkColor color); + base::char16 accelerator() const { return accelerator_; } // views::MenuButton: diff --git a/vendor/brightray b/vendor/brightray index 759cf77253e..dafc85799ca 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 759cf77253e8d3996745b6f6aeedcf3cb9465bbb +Subproject commit dafc85799ca31e3ddd7b5d0cc0ef7fbf38dcf88f From d9d1d03d4d159f8755fb4b695a75518601d0e962 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 20:22:38 +0800 Subject: [PATCH 12/15] linux: Dont' use native style border. --- atom/browser/ui/views/submenu_button.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/browser/ui/views/submenu_button.cc b/atom/browser/ui/views/submenu_button.cc index 5049ffb0f48..e0a7eee00df 100644 --- a/atom/browser/ui/views/submenu_button.cc +++ b/atom/browser/ui/views/submenu_button.cc @@ -8,6 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "ui/gfx/canvas.h" #include "ui/gfx/text_utils.h" +#include "ui/views/controls/button/label_button_border.h" namespace atom { @@ -34,7 +35,11 @@ SubmenuButton::SubmenuButton(views::ButtonListener* listener, text_width_(0), text_height_(0), underline_color_(SK_ColorBLACK) { - SetStyle(views::Button::STYLE_TEXTBUTTON); +#if defined(OS_LINUX) + // Dont' use native style border. + SetBorder(CreateDefaultBorder().PassAs()); +#endif + if (GetUnderlinePosition(title, &accelerator_, &underline_start_, &underline_end_)) gfx::Canvas::SizeStringInt(GetText(), GetFontList(), &text_width_, From 3b95f49a14bd33458ef91bed9b201904fe5e004c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 21:30:53 +0800 Subject: [PATCH 13/15] Upgrade node to fix child_process.fork. --- vendor/node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/node b/vendor/node index 7297b341778..20b07f3e991 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit 7297b341778d8c0f8828a396889635cc3f537387 +Subproject commit 20b07f3e991f82d6aef22e8b8212f19ef1cb5bcb From 533548fdc77f4db26c68159c1ed6fa98ec161e88 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 1 Sep 2014 22:54:20 +0800 Subject: [PATCH 14/15] Use atom-shell's version for creating node headers tarball. --- script/bootstrap.py | 3 +-- script/create-dist.py | 6 +++--- script/lib/config.py | 1 - script/upload.py | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 5ce068bfab9..516e0b4d0e9 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -4,7 +4,7 @@ import argparse import os import sys -from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, NODE_VERSION +from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL from lib.util import execute, scoped_cwd, enable_verbose_execute @@ -65,7 +65,6 @@ def update_node_modules(dirname): def update_atom_modules(dirname): - os.environ['ATOM_NODE_VERSION'] = NODE_VERSION[1:] with scoped_cwd(dirname): apm = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'apm') if sys.platform in ['win32', 'cygwin']: diff --git a/script/create-dist.py b/script/create-dist.py index 3c6be9af1e6..5188fbfdf86 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -8,8 +8,8 @@ import subprocess import sys import tarfile -from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, NODE_VERSION, \ - TARGET_PLATFORM, DIST_ARCH +from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \ + DIST_ARCH from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \ safe_mkdir, execute @@ -20,7 +20,7 @@ SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) DIST_DIR = os.path.join(SOURCE_ROOT, 'dist') OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'Release') NODE_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'node') -DIST_HEADERS_NAME = 'node-{0}'.format(NODE_VERSION) +DIST_HEADERS_NAME = 'node-{0}'.format(ATOM_SHELL_VERSION) DIST_HEADERS_DIR = os.path.join(DIST_DIR, DIST_HEADERS_NAME) SYMBOL_NAME = { diff --git a/script/lib/config.py b/script/lib/config.py index 63954b2fa88..db6c1a97064 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -3,7 +3,6 @@ import platform import sys -NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '2cf80c1743e370c12eb7bf078eb425f3cc355383' diff --git a/script/upload.py b/script/upload.py index 5f9f355e4ed..c7480b939a5 100755 --- a/script/upload.py +++ b/script/upload.py @@ -8,7 +8,7 @@ import subprocess import sys import tempfile -from lib.config import DIST_ARCH, NODE_VERSION, TARGET_PLATFORM +from lib.config import DIST_ARCH, TARGET_PLATFORM from lib.util import get_atom_shell_version, scoped_cwd, safe_mkdir, execute, \ s3_config, s3put from lib.github import GitHub @@ -51,7 +51,7 @@ def main(): # Upload node's headers to S3. bucket, access_key, secret_key = s3_config() - upload_node(bucket, access_key, secret_key, NODE_VERSION) + upload_node(bucket, access_key, secret_key, ATOM_SHELL_VERSION) if args.publish_release: # Press the publish button. @@ -60,7 +60,7 @@ def main(): # Upload the SHASUMS.txt. execute([sys.executable, os.path.join(SOURCE_ROOT, 'script', 'upload-checksums.py'), - '-v', NODE_VERSION]) + '-v', ATOM_SHELL_VERSION]) def parse_args(): From b00e56f58753faa8219e4bebbc46197b585197a8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 2 Sep 2014 10:58:42 +0800 Subject: [PATCH 15/15] Upgrade to apm@0.93.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 083482b0c23..b5e5348ef0f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ], "devDependencies": { - "atom-package-manager": "0.89.0", + "atom-package-manager": "0.93.0", "coffee-script": "~1.7.1", "coffeelint": "~1.3.0" },