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

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

Issue 1780083002: Introduce Platform::setCurrentPlatformForTesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 /* 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 CompositorFactory::shutdown(); 75 CompositorFactory::shutdown();
76 76
77 if (s_platform->m_mainThread) 77 if (s_platform->m_mainThread)
78 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance()); 78 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance());
79 79
80 if (s_platform) 80 if (s_platform)
81 s_platform->m_mainThread = 0; 81 s_platform->m_mainThread = 0;
82 s_platform = 0; 82 s_platform = 0;
83 } 83 }
84 84
85 void Platform::setCurrentPlatformForTesting(Platform* platform)
86 {
87 s_platform = platform;
88 if (s_platform)
89 s_platform->m_mainThread = platform->currentThread();
90 }
91
85 Platform* Platform::current() 92 Platform* Platform::current()
86 { 93 {
87 return s_platform; 94 return s_platform;
88 } 95 }
89 96
90 WebThread* Platform::mainThread() const 97 WebThread* Platform::mainThread() const
91 { 98 {
92 return m_mainThread; 99 return m_mainThread;
93 } 100 }
94 101
(...skipping 12 matching lines...) Expand all
107 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); 114 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider);
108 if (it == memoryDumpProviders().end()) 115 if (it == memoryDumpProviders().end())
109 return; 116 return;
110 WebMemoryDumpProviderAdapter* adapter = it->value.get(); 117 WebMemoryDumpProviderAdapter* adapter = it->value.get();
111 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter); 118 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter);
112 adapter->set_is_registered(false); 119 adapter->set_is_registered(false);
113 memoryDumpProviders().remove(it); 120 memoryDumpProviders().remove(it);
114 } 121 }
115 122
116 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698