Revert "Revert "Use chunks in trace event buffers""

This reverts commit 6d48f5ec0a410a2309ff3e24f4a91039f83a57c1.

Fixed the misplaced weak_clear() (that I misunderstood it would only
clear the pointers not the vector). As we only need to store the weak
pointers now changed to use scoped_ptr<TraceBufferChunk*[]>.

>
> Revert "Use chunks in trace event buffers"
>
> This reverts commit cb13e0a5455c86507e493498bb232e98467333c1 because
> of unit test failure (though try bots passed).
>
> > Use chunks in trace event buffers
> >
> > Separated from https://codereview.chromium.org/23799005/.
> >
> > Chunks are fixed sized arrays of TraceEvents in trace event buffers.
> > Each thread borrows a chunk from the buffer, adds thread-local events
> > into the chunk without locking, and returns the chunk when it is full.
> >
> > TraceLog also gets a chunk from the buffer for events that are not
> > suitable to use thread-local buffer.
> >
> > With the chunks, TraceEvent never copies except when the trace buffer
> > is cloned.
> >
> > Changed |flush_count_| to |generation| which indicates the version of
> > the central TraceBuffer. If a thread failed to flush in the last flush,
> > it may still hold a TraceBufferChunk from the original TraceBuffer.
> > |generation| controls the thread not to return the chunk to the current
> > TraceBuffer.
> >
> > This is preparation for the new design for X events which exposes
> > TraceEventHandle through TRACE_EVENT_API.
> >
> > BUG=trace-viewer:142
> > TEST=Existing TraceEventTestFixture.* tests
> > TEST=TraceEventTestFixture.TraceBufferRingBuffer*
> >
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227783
>
> NOTRY=true
> TBR=msw
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227816

TBR=dsinclair

Review URL: https://codereview.chromium.org/26757003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227903 0039d316-1c4b-4281-b951-d872f2087c98
Mojo: Move argument validation from MessagePipe to MessagePipeDispatcher.

This is so other internal code will be able to add/remove messages without the
validation overhead. (I'll probably refactor it some more.)

R=darin

Review URL: https://codereview.chromium.org/26759004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227904 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 227904