Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/renderer/extensions/render_view_observer_natives.cc

Issue 23636015: Remove unsafe access hacks from ScopedPersistent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review (jyasskin)' Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/render_view_observer_natives.h" 5 #include "chrome/renderer/extensions/render_view_observer_natives.h"
6 6
7 #include "chrome/common/extensions/api/extension_api.h" 7 #include "chrome/common/extensions/api/extension_api.h"
8 #include "chrome/renderer/extensions/dispatcher.h" 8 #include "chrome/renderer/extensions/dispatcher.h"
9 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
10 #include "content/public/renderer/render_view_observer.h" 10 #include "content/public/renderer/render_view_observer.h"
(...skipping 22 matching lines...) Expand all
33 virtual void DidFailProvisionalLoad( 33 virtual void DidFailProvisionalLoad(
34 WebKit::WebFrame* frame, 34 WebKit::WebFrame* frame,
35 const WebKit::WebURLError& error) OVERRIDE { 35 const WebKit::WebURLError& error) OVERRIDE {
36 CallbackAndDie(false); 36 CallbackAndDie(false);
37 } 37 }
38 38
39 private: 39 private:
40 void CallbackAndDie(bool succeeded) { 40 void CallbackAndDie(bool succeeded) {
41 v8::HandleScope handle_scope(context_->isolate()); 41 v8::HandleScope handle_scope(context_->isolate());
42 v8::Handle<v8::Value> args[] = { v8::Boolean::New(succeeded) }; 42 v8::Handle<v8::Value> args[] = { v8::Boolean::New(succeeded) };
43 context_->CallFunction(callback_.get(), 1, args); 43 context_->CallFunction(callback_.NewHandle(context_->isolate()), 1, args);
44 delete this; 44 delete this;
45 } 45 }
46 46
47 ChromeV8Context* context_; 47 ChromeV8Context* context_;
48 ScopedPersistent<v8::Function> callback_; 48 ScopedPersistent<v8::Function> callback_;
49 DISALLOW_COPY_AND_ASSIGN(LoadWatcher); 49 DISALLOW_COPY_AND_ASSIGN(LoadWatcher);
50 }; 50 };
51 } // namespace 51 } // namespace
52 52
53 53
(...skipping 18 matching lines...) Expand all
72 LOG(WARNING) << "No render view found to register LoadWatcher."; 72 LOG(WARNING) << "No render view found to register LoadWatcher.";
73 return; 73 return;
74 } 74 }
75 75
76 new LoadWatcher(context(), view, args[1].As<v8::Function>()); 76 new LoadWatcher(context(), view, args[1].As<v8::Function>());
77 77
78 args.GetReturnValue().Set(true); 78 args.GetReturnValue().Set(true);
79 } 79 }
80 80
81 } // namespace extensions 81 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/object_backed_native_handler.cc ('k') | chrome/renderer/extensions/scoped_persistent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698