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

Side by Side Diff: extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/guest_view/guest_view_internal_custom_bindings.h" 5 #include "extensions/renderer/guest_view/guest_view_internal_custom_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 32
33 using content::V8ValueConverter; 33 using content::V8ValueConverter;
34 34
35 namespace { 35 namespace {
36 36
37 // A map from view instance ID to view object (stored via weak V8 reference). 37 // A map from view instance ID to view object (stored via weak V8 reference).
38 // Views are registered into this map via 38 // Views are registered into this map via
39 // GuestViewInternalCustomBindings::RegisterView(), and accessed via 39 // GuestViewInternalCustomBindings::RegisterView(), and accessed via
40 // GuestViewInternalCustomBindings::GetViewFromID(). 40 // GuestViewInternalCustomBindings::GetViewFromID().
41 using ViewMap = std::map<int, v8::Global<v8::Object>*>; 41 using ViewMap = std::map<int, v8::Global<v8::Object>*>;
42 static base::LazyInstance<ViewMap> weak_view_map = LAZY_INSTANCE_INITIALIZER; 42 static base::LazyInstance<ViewMap>::DestructorAtExit weak_view_map =
43 LAZY_INSTANCE_INITIALIZER;
43 44
44 } // namespace 45 } // namespace
45 46
46 namespace extensions { 47 namespace extensions {
47 48
48 namespace { 49 namespace {
49 50
50 content::RenderFrame* GetRenderFrame(v8::Handle<v8::Value> value) { 51 content::RenderFrame* GetRenderFrame(v8::Handle<v8::Value> value) {
51 v8::Local<v8::Context> context = 52 v8::Local<v8::Context> context =
52 v8::Local<v8::Object>::Cast(value)->CreationContext(); 53 v8::Local<v8::Object>::Cast(value)->CreationContext();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // EnterFullscreen() and do it directly rather than having a generic "run with 459 // EnterFullscreen() and do it directly rather than having a generic "run with
459 // user gesture" function. 460 // user gesture" function.
460 blink::WebScopedUserGesture user_gesture(context()->web_frame()); 461 blink::WebScopedUserGesture user_gesture(context()->web_frame());
461 CHECK_EQ(args.Length(), 1); 462 CHECK_EQ(args.Length(), 1);
462 CHECK(args[0]->IsFunction()); 463 CHECK(args[0]->IsFunction());
463 context()->SafeCallFunction( 464 context()->SafeCallFunction(
464 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); 465 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr);
465 } 466 }
466 467
467 } // namespace extensions 468 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698