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

Side by Side Diff: third_party/WebKit/Source/platform/exported/Platform.cpp

Issue 2811463002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/exported (Closed)
Patch Set: rebase Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask( 86 Platform::Current()->MainThread()->GetWebTaskRunner()->PostTask(
87 BLINK_FROM_HERE, 87 BLINK_FROM_HERE,
88 CrossThreadBind(function, CrossThreadUnretained(context))); 88 CrossThreadBind(function, CrossThreadUnretained(context)));
89 } 89 }
90 90
91 Platform::Platform() : main_thread_(0) { 91 Platform::Platform() : main_thread_(0) {
92 WTF::Partitions::Initialize(MaxObservedSizeFunction); 92 WTF::Partitions::Initialize(MaxObservedSizeFunction);
93 } 93 }
94 94
95 void Platform::Initialize(Platform* platform) { 95 void Platform::Initialize(Platform* platform) {
96 ASSERT(!g_platform); 96 DCHECK(!g_platform);
97 ASSERT(platform); 97 DCHECK(platform);
98 g_platform = platform; 98 g_platform = platform;
99 g_platform->main_thread_ = platform->CurrentThread(); 99 g_platform->main_thread_ = platform->CurrentThread();
100 100
101 WTF::Initialize(CallOnMainThreadFunction); 101 WTF::Initialize(CallOnMainThreadFunction);
102 102
103 ProcessHeap::Init(); 103 ProcessHeap::Init();
104 MemoryCoordinator::Initialize(); 104 MemoryCoordinator::Initialize();
105 if (base::ThreadTaskRunnerHandle::IsSet()) 105 if (base::ThreadTaskRunnerHandle::IsSet())
106 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 106 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
107 BlinkGCMemoryDumpProvider::Instance(), "BlinkGC", 107 BlinkGCMemoryDumpProvider::Instance(), "BlinkGC",
108 base::ThreadTaskRunnerHandle::Get()); 108 base::ThreadTaskRunnerHandle::Get());
109 109
110 ThreadState::AttachMainThread(); 110 ThreadState::AttachMainThread();
111 111
112 // TODO(ssid): remove this check after fixing crbug.com/486782. 112 // TODO(ssid): remove this check after fixing crbug.com/486782.
113 if (g_platform->main_thread_) { 113 if (g_platform->main_thread_) {
114 ASSERT(!g_gc_task_runner); 114 DCHECK(!g_gc_task_runner);
115 g_gc_task_runner = new GCTaskRunner(g_platform->main_thread_); 115 g_gc_task_runner = new GCTaskRunner(g_platform->main_thread_);
116 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 116 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
117 PartitionAllocMemoryDumpProvider::Instance(), "PartitionAlloc", 117 PartitionAllocMemoryDumpProvider::Instance(), "PartitionAlloc",
118 base::ThreadTaskRunnerHandle::Get()); 118 base::ThreadTaskRunnerHandle::Get());
119 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 119 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
120 FontCacheMemoryDumpProvider::Instance(), "FontCaches", 120 FontCacheMemoryDumpProvider::Instance(), "FontCaches",
121 base::ThreadTaskRunnerHandle::Get()); 121 base::ThreadTaskRunnerHandle::Get());
122 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 122 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
123 MemoryCacheDumpProvider::Instance(), "MemoryCache", 123 MemoryCacheDumpProvider::Instance(), "MemoryCache",
124 base::ThreadTaskRunnerHandle::Get()); 124 base::ThreadTaskRunnerHandle::Get());
125 } 125 }
126 } 126 }
127 127
128 void Platform::SetCurrentPlatformForTesting(Platform* platform) { 128 void Platform::SetCurrentPlatformForTesting(Platform* platform) {
129 ASSERT(platform); 129 DCHECK(platform);
130 g_platform = platform; 130 g_platform = platform;
131 g_platform->main_thread_ = platform->CurrentThread(); 131 g_platform->main_thread_ = platform->CurrentThread();
132 } 132 }
133 133
134 Platform* Platform::Current() { 134 Platform* Platform::Current() {
135 return g_platform; 135 return g_platform;
136 } 136 }
137 137
138 WebThread* Platform::MainThread() const { 138 WebThread* Platform::MainThread() const {
139 return main_thread_; 139 return main_thread_;
140 } 140 }
141 141
142 service_manager::Connector* Platform::GetConnector() { 142 service_manager::Connector* Platform::GetConnector() {
143 DEFINE_STATIC_LOCAL(DefaultConnector, connector, ()); 143 DEFINE_STATIC_LOCAL(DefaultConnector, connector, ());
144 return connector.Get(); 144 return connector.Get();
145 } 145 }
146 146
147 InterfaceProvider* Platform::GetInterfaceProvider() { 147 InterfaceProvider* Platform::GetInterfaceProvider() {
148 return InterfaceProvider::GetEmptyInterfaceProvider(); 148 return InterfaceProvider::GetEmptyInterfaceProvider();
149 } 149 }
150 150
151 } // namespace blink 151 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698