Fix compilation errors

This commit is contained in:
Cheng Zhao 2015-05-22 15:24:34 +08:00
parent c82d21b39f
commit 01e891652f
7 changed files with 34 additions and 40 deletions

View file

@ -22,6 +22,7 @@
#include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents.h"
#include "brightray/browser/media/media_stream_devices_controller.h" #include "brightray/browser/media/media_stream_devices_controller.h"
#include "content/public/browser/favicon_status.h" #include "content/public/browser/favicon_status.h"
#include "content/public/browser/guest_host.h"
#include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/plugin_service.h" #include "content/public/browser/plugin_service.h"
@ -81,7 +82,7 @@ WebContents::WebContents(content::WebContents* web_contents)
guest_instance_id_(-1), guest_instance_id_(-1),
element_instance_id_(-1), element_instance_id_(-1),
guest_opaque_(true), guest_opaque_(true),
guest_sizer_(nullptr), guest_host_(nullptr),
auto_size_enabled_(false) { auto_size_enabled_(false) {
} }
@ -89,7 +90,7 @@ WebContents::WebContents(const mate::Dictionary& options)
: guest_instance_id_(-1), : guest_instance_id_(-1),
element_instance_id_(-1), element_instance_id_(-1),
guest_opaque_(true), guest_opaque_(true),
guest_sizer_(nullptr), guest_host_(nullptr),
auto_size_enabled_(false) { auto_size_enabled_(false) {
options.Get("guestInstanceId", &guest_instance_id_); options.Get("guestInstanceId", &guest_instance_id_);
@ -299,11 +300,11 @@ void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
Emit("did-fail-load", error_code, error_description); Emit("did-fail-load", error_code, error_description);
} }
void WebContents::DidStartLoading(content::RenderViewHost* render_view_host) { void WebContents::DidStartLoading() {
Emit("did-start-loading"); Emit("did-start-loading");
} }
void WebContents::DidStopLoading(content::RenderViewHost* render_view_host) { void WebContents::DidStopLoading() {
Emit("did-stop-loading"); Emit("did-stop-loading");
} }
@ -406,7 +407,7 @@ void WebContents::ElementSizeChanged(const gfx::Size& size) {
// Only resize if needed. // Only resize if needed.
if (!size.IsEmpty()) if (!size.IsEmpty())
guest_sizer_->SizeContents(size); guest_host_->SizeContents(size);
} }
content::WebContents* WebContents::GetOwnerWebContents() const { content::WebContents* WebContents::GetOwnerWebContents() const {
@ -420,13 +421,8 @@ void WebContents::GuestSizeChanged(const gfx::Size& new_size) {
guest_size_ = new_size; guest_size_ = new_size;
} }
void WebContents::RegisterDestructionCallback( void WebContents::SetGuestHost(content::GuestHost* guest_host) {
const DestructionCallback& callback) { guest_host_ = guest_host;
destruction_callback_ = callback;
}
void WebContents::SetGuestSizer(content::GuestSizer* guest_sizer) {
guest_sizer_ = guest_sizer;
} }
void WebContents::WillAttach(content::WebContents* embedder_web_contents, void WebContents::WillAttach(content::WebContents* embedder_web_contents,
@ -438,12 +434,13 @@ void WebContents::WillAttach(content::WebContents* embedder_web_contents,
void WebContents::Destroy() { void WebContents::Destroy() {
if (storage_) { if (storage_) {
if (!destruction_callback_.is_null())
destruction_callback_.Run();
// When force destroying the "destroyed" event is not emitted. // When force destroying the "destroyed" event is not emitted.
WebContentsDestroyed(); WebContentsDestroyed();
// Give the content module an opportunity to perform some cleanup.
guest_host_->WillDestroy();
guest_host_ = nullptr;
Observe(nullptr); Observe(nullptr);
storage_.reset(); storage_.reset();
} }

View file

@ -172,8 +172,8 @@ class WebContents : public mate::EventEmitter,
const GURL& validated_url, const GURL& validated_url,
int error_code, int error_code,
const base::string16& error_description) override; const base::string16& error_description) override;
void DidStartLoading(content::RenderViewHost* render_view_host) override; void DidStartLoading() override;
void DidStopLoading(content::RenderViewHost* render_view_host) override; void DidStopLoading() override;
void DidGetResourceResponseStart( void DidGetResourceResponseStart(
const content::ResourceRequestDetails& details) override; const content::ResourceRequestDetails& details) override;
void DidGetRedirectForResourceRequest( void DidGetRedirectForResourceRequest(
@ -198,8 +198,7 @@ class WebContents : public mate::EventEmitter,
void ElementSizeChanged(const gfx::Size& size) final; void ElementSizeChanged(const gfx::Size& size) final;
content::WebContents* GetOwnerWebContents() const final; content::WebContents* GetOwnerWebContents() const final;
void GuestSizeChanged(const gfx::Size& new_size) final; void GuestSizeChanged(const gfx::Size& new_size) final;
void RegisterDestructionCallback(const DestructionCallback& callback) final; void SetGuestHost(content::GuestHost* guest_host) final;
void SetGuestSizer(content::GuestSizer* guest_sizer) final;
void WillAttach(content::WebContents* embedder_web_contents, void WillAttach(content::WebContents* embedder_web_contents,
int element_instance_id, int element_instance_id,
bool is_full_page_plugin) final; bool is_full_page_plugin) final;
@ -230,8 +229,6 @@ class WebContents : public mate::EventEmitter,
// element. // element.
int element_instance_id_; int element_instance_id_;
DestructionCallback destruction_callback_;
// Stores whether the contents of the guest can be transparent. // Stores whether the contents of the guest can be transparent.
bool guest_opaque_; bool guest_opaque_;
@ -248,8 +245,8 @@ class WebContents : public mate::EventEmitter,
// element may not match the size of the guest. // element may not match the size of the guest.
gfx::Size guest_size_; gfx::Size guest_size_;
// A pointer to the guest_sizer. // A pointer to the guest_host.
content::GuestSizer* guest_sizer_; content::GuestHost* guest_host_;
// Indicates whether autosize mode is enabled or not. // Indicates whether autosize mode is enabled or not.
bool auto_size_enabled_; bool auto_size_enabled_;

View file

@ -30,7 +30,7 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager {
const DialogClosedCallback& callback) override; const DialogClosedCallback& callback) override;
void CancelActiveAndPendingDialogs( void CancelActiveAndPendingDialogs(
content::WebContents* web_contents) override {} content::WebContents* web_contents) override {}
void WebContentsDestroyed(content::WebContents* web_contents) override {} void ResetDialogState(content::WebContents* web_contents) override {};
}; };
} // namespace atom } // namespace atom

View file

@ -39,8 +39,7 @@ void SetDestructor(v8::Isolate* isolate,
} }
void TakeHeapSnapshot(v8::Isolate* isolate) { void TakeHeapSnapshot(v8::Isolate* isolate) {
isolate->GetHeapProfiler()->TakeHeapSnapshot( isolate->GetHeapProfiler()->TakeHeapSnapshot();
mate::StringToV8(isolate, "test"));
} }
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused, void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,

View file

@ -15,8 +15,9 @@
#include "base/files/file.h" #include "base/files/file.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/pickle.h" #include "base/pickle.h"
#include "base/json/json_string_value_serializer.h" #include "base/json/json_reader.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/values.h"
namespace asar { namespace asar {
@ -149,15 +150,15 @@ bool Archive::Init() {
} }
std::string error; std::string error;
JSONStringValueSerializer serializer(&header); base::JSONReader reader;
base::Value* value = serializer.Deserialize(NULL, &error); scoped_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) { if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
LOG(ERROR) << "Failed to parse header: " << error; LOG(ERROR) << "Failed to parse header: " << error;
return false; return false;
} }
header_size_ = 8 + size; header_size_ = 8 + size;
header_.reset(static_cast<base::DictionaryValue*>(value)); header_.reset(static_cast<base::DictionaryValue*>(value.release()));
return true; return true;
} }

View file

@ -16,10 +16,11 @@
#include "chrome/renderer/printing/print_web_view_helper.h" #include "chrome/renderer/printing/print_web_view_helper.h"
#include "chrome/renderer/tts_dispatcher.h" #include "chrome/renderer/tts_dispatcher.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "third_party/WebKit/public/web/WebCustomElement.h" #include "third_party/WebKit/public/web/WebCustomElement.h"
#include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginParams.h" #include "third_party/WebKit/public/web/WebPluginParams.h"
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
@ -56,10 +57,11 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
renderer_client_(renderer_client) {} renderer_client_(renderer_client) {}
// content::RenderFrameObserver: // content::RenderFrameObserver:
void DidCreateScriptContext(blink::WebFrame* frame, void DidCreateScriptContext(v8::Handle<v8::Context> context,
v8::Handle<v8::Context> context, int extension_group,
int world_id) { int world_id) {
renderer_client_->DidCreateScriptContext(frame, context, world_id); renderer_client_->DidCreateScriptContext(
render_frame()->GetWebFrame(), context);
} }
private: private:
@ -131,10 +133,9 @@ bool AtomRendererClient::OverrideCreatePlugin(
return true; return true;
} }
void AtomRendererClient::DidCreateScriptContext(blink::WebFrame* frame, void AtomRendererClient::DidCreateScriptContext(
v8::Handle<v8::Context> context, blink::WebFrame* frame,
int extension_group, v8::Handle<v8::Context> context) {
int world_id) {
// Only attach node bindings in main frame or guest frame. // Only attach node bindings in main frame or guest frame.
if (!IsGuestFrame(frame)) { if (!IsGuestFrame(frame)) {
if (main_frame_) if (main_frame_)

View file

@ -22,8 +22,7 @@ class AtomRendererClient : public content::ContentRendererClient,
virtual ~AtomRendererClient(); virtual ~AtomRendererClient();
void DidCreateScriptContext(blink::WebFrame* frame, void DidCreateScriptContext(blink::WebFrame* frame,
v8::Handle<v8::Context> context, v8::Handle<v8::Context> context);
int world_id);
private: private:
enum NodeIntegration { enum NodeIntegration {