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

Side by Side Diff: Source/modules/webmidi/MIDIAccessor.h

Issue 311773003: Decouple MIDIAccess initialization from MIDIAccess class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 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
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.cpp ('k') | Source/modules/webmidi/MIDIClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 30 matching lines...) Expand all
41 class MIDIAccessorClient; 41 class MIDIAccessorClient;
42 42
43 class MIDIAccessor FINAL : public blink::WebMIDIAccessorClient { 43 class MIDIAccessor FINAL : public blink::WebMIDIAccessorClient {
44 public: 44 public:
45 static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*); 45 static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*);
46 46
47 virtual ~MIDIAccessor() { } 47 virtual ~MIDIAccessor() { }
48 48
49 void startSession(); 49 void startSession();
50 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStamp); 50 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStamp);
51 // MIDIAccessInitializer and MIDIAccess are both MIDIAccessClient.
52 // MIDIAccessInitializer is the first client and MIDIAccess takes over it
53 // once the initialization successfully finishes.
54 void setClient(MIDIAccessorClient* client) { m_client = client; }
51 55
52 // blink::WebMIDIAccessorClient 56 // blink::WebMIDIAccessorClient
53 virtual void didAddInputPort(const blink::WebString& id, const blink::WebStr ing& manufacturer, const blink::WebString& name, const blink::WebString& version ) OVERRIDE; 57 virtual void didAddInputPort(const blink::WebString& id, const blink::WebStr ing& manufacturer, const blink::WebString& name, const blink::WebString& version ) OVERRIDE;
54 virtual void didAddOutputPort(const blink::WebString& id, const blink::WebSt ring& manufacturer, const blink::WebString& name, const blink::WebString& versio n) OVERRIDE; 58 virtual void didAddOutputPort(const blink::WebString& id, const blink::WebSt ring& manufacturer, const blink::WebString& name, const blink::WebString& versio n) OVERRIDE;
55 virtual void didStartSession(bool success, const blink::WebString& error, co nst blink::WebString& message) OVERRIDE; 59 virtual void didStartSession(bool success, const blink::WebString& error, co nst blink::WebString& message) OVERRIDE;
56 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) OVERRIDE; 60 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) OVERRIDE;
57 61
58 private: 62 private:
59 explicit MIDIAccessor(MIDIAccessorClient*); 63 explicit MIDIAccessor(MIDIAccessorClient*);
60 64
61 MIDIAccessorClient* m_client; 65 MIDIAccessorClient* m_client;
62 OwnPtr<blink::WebMIDIAccessor> m_accessor; 66 OwnPtr<blink::WebMIDIAccessor> m_accessor;
63 }; 67 };
64 68
65 } // namespace WebCore 69 } // namespace WebCore
66 70
67 #endif // MIDIAccessor_h 71 #endif // MIDIAccessor_h
OLDNEW
« no previous file with comments | « Source/modules/webmidi/MIDIAccessInitializer.cpp ('k') | Source/modules/webmidi/MIDIClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698