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

Side by Side Diff: Source/core/inspector/InspectorMemoryAgent.cpp

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments Created 7 years, 6 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 size_t privateBytes = 0; 313 size_t privateBytes = 0;
314 size_t sharedBytes = 0; 314 size_t sharedBytes = 0;
315 MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes); 315 MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes);
316 processMemory->setSize(privateBytes); 316 processMemory->setSize(privateBytes);
317 } 317 }
318 318
319 void InspectorMemoryAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 319 void InspectorMemoryAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
320 { 320 {
321 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector); 321 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Inspector);
322 InspectorBaseAgent<InspectorMemoryAgent>::reportMemoryUsage(memoryObjectInfo ); 322 InspectorBaseAgent::reportMemoryUsage(memoryObjectInfo);
323 info.addWeakPointer(m_inspectorClient); 323 info.addWeakPointer(m_inspectorClient);
324 info.addMember(m_page, "page"); 324 info.addMember(m_page, "page");
325 } 325 }
326 326
327 namespace { 327 namespace {
328 328
329 class FrontendWrapper : public HeapGraphSerializer::Client { 329 class FrontendWrapper : public HeapGraphSerializer::Client {
330 public: 330 public:
331 explicit FrontendWrapper(InspectorFrontend::Memory* frontend) : m_frontend(f rontend) { } 331 explicit FrontendWrapper(InspectorFrontend::Memory* frontend) : m_frontend(f rontend) { }
332 virtual void addNativeSnapshotChunk(PassRefPtr<TypeBuilder::Memory::HeapSnap shotChunk> heapSnapshotChunk) OVERRIDE 332 virtual void addNativeSnapshotChunk(PassRefPtr<TypeBuilder::Memory::HeapSnap shotChunk> heapSnapshotChunk) OVERRIDE
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 371 }
372 372
373 m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient .countedObjects()); 373 m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient .countedObjects());
374 374
375 *memoryInfo = memoryInstrumentationClient.sizesMap(); 375 *memoryInfo = memoryInstrumentationClient.sizesMap();
376 addPlatformComponentsInfo(memoryInfo); 376 addPlatformComponentsInfo(memoryInfo);
377 addMemoryInstrumentationDebugData(&memoryInstrumentationClient, memoryInfo); 377 addMemoryInstrumentationDebugData(&memoryInstrumentationClient, memoryInfo);
378 return meta.release(); 378 return meta.release();
379 } 379 }
380 380
381 InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAge nts, InspectorClient* client, InspectorCompositeState* state, Page* page) 381 InspectorMemoryAgent::InspectorMemoryAgent(InstrumentingAgents* instrumentingAge nts, InspectorClient* client, InspectorState* state, Page* page)
382 : InspectorBaseAgent<InspectorMemoryAgent>("Memory", instrumentingAgents, st ate) 382 : InspectorBaseAgent(instrumentingAgents, state)
383 , m_inspectorClient(client) 383 , m_inspectorClient(client)
384 , m_page(page) 384 , m_page(page)
385 , m_frontend(0) 385 , m_frontend(0)
386 { 386 {
387 } 387 }
388 388
389 void InspectorMemoryAgent::setFrontend(InspectorFrontend* frontend) 389 void InspectorMemoryAgent::setFrontend(InspectorFrontend* frontend)
390 { 390 {
391 ASSERT(!m_frontend); 391 ASSERT(!m_frontend);
392 m_frontend = frontend->memory(); 392 m_frontend = frontend->memory();
393 } 393 }
394 394
395 void InspectorMemoryAgent::clearFrontend() 395 void InspectorMemoryAgent::clearFrontend()
396 { 396 {
397 m_frontend = 0; 397 m_frontend = 0;
398 } 398 }
399 399
400 } // namespace WebCore 400 } // namespace WebCore
401 401
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorMemoryAgent.h ('k') | Source/core/inspector/InspectorPageAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698