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

Side by Side Diff: android_webview/native/aw_contents_io_thread_client_impl.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/native/aw_contents_io_thread_client_impl.h" 5 #include "android_webview/native/aw_contents_io_thread_client_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // RfhToIoThreadClientMap ----------------------------------------------------- 64 // RfhToIoThreadClientMap -----------------------------------------------------
65 class RfhToIoThreadClientMap { 65 class RfhToIoThreadClientMap {
66 public: 66 public:
67 static RfhToIoThreadClientMap* GetInstance(); 67 static RfhToIoThreadClientMap* GetInstance();
68 void Set(pair<int, int> rfh_id, const IoThreadClientData& client); 68 void Set(pair<int, int> rfh_id, const IoThreadClientData& client);
69 bool Get(pair<int, int> rfh_id, IoThreadClientData* client); 69 bool Get(pair<int, int> rfh_id, IoThreadClientData* client);
70 void Erase(pair<int, int> rfh_id); 70 void Erase(pair<int, int> rfh_id);
71 71
72 private: 72 private:
73 static LazyInstance<RfhToIoThreadClientMap> g_instance_; 73 static LazyInstance<RfhToIoThreadClientMap>::DestructorAtExit g_instance_;
74 base::Lock map_lock_; 74 base::Lock map_lock_;
75 RenderFrameHostToIoThreadClientType rfh_to_io_thread_client_; 75 RenderFrameHostToIoThreadClientType rfh_to_io_thread_client_;
76 }; 76 };
77 77
78 // static 78 // static
79 LazyInstance<RfhToIoThreadClientMap> RfhToIoThreadClientMap::g_instance_ = 79 LazyInstance<RfhToIoThreadClientMap>::DestructorAtExit
80 RfhToIoThreadClientMap::g_instance_ = LAZY_INSTANCE_INITIALIZER;
81
82 // static
83 LazyInstance<JavaObjectWeakGlobalRef>::DestructorAtExit g_sw_instance_ =
80 LAZY_INSTANCE_INITIALIZER; 84 LAZY_INSTANCE_INITIALIZER;
81 85
82 // static 86 // static
83 LazyInstance<JavaObjectWeakGlobalRef> g_sw_instance_ =
84 LAZY_INSTANCE_INITIALIZER;
85
86 // static
87 RfhToIoThreadClientMap* RfhToIoThreadClientMap::GetInstance() { 87 RfhToIoThreadClientMap* RfhToIoThreadClientMap::GetInstance() {
88 return g_instance_.Pointer(); 88 return g_instance_.Pointer();
89 } 89 }
90 90
91 void RfhToIoThreadClientMap::Set(pair<int, int> rfh_id, 91 void RfhToIoThreadClientMap::Set(pair<int, int> rfh_id,
92 const IoThreadClientData& client) { 92 const IoThreadClientData& client) {
93 base::AutoLock lock(map_lock_); 93 base::AutoLock lock(map_lock_);
94 rfh_to_io_thread_client_[rfh_id] = client; 94 rfh_to_io_thread_client_[rfh_id] = client;
95 } 95 }
96 96
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 DCHECK_CURRENTLY_ON(BrowserThread::IO); 347 DCHECK_CURRENTLY_ON(BrowserThread::IO);
348 if (java_object_.is_null()) 348 if (java_object_.is_null())
349 return false; 349 return false;
350 350
351 JNIEnv* env = AttachCurrentThread(); 351 JNIEnv* env = AttachCurrentThread();
352 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(env, 352 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(env,
353 java_object_); 353 java_object_);
354 } 354 }
355 355
356 } // namespace android_webview 356 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698